It allows full control of the CDO Message object.
You can create a new instance of the class with the following:
Dim clsSendMail Set clsSendMail = New SendMail
Then add the various properties of the email:
clsSendMail.SendTo = "email@example.com" clsSendMail.From = "firstname.lastname@example.org" clsSendMail.Subject = "Test Message"
Next you choose what type of mail you are going to send: plain text, HTML or from a URL or local file.
|Plain Text||TextBody||clsSendMail.TextBody = "message here"|
|HTML||HTMLBody||clsSendMail.HTMLBody = "<b>html</b> message here"|
|URL||CreateMHTMLBody||Call clsSendMail.CreateMHTMLBody "http://www.url.com/pagename.htm"|
|Local File||CreateMHTMLBody||Call clsSendMail.CreateMHTMLBody "file://c:/mydocuments/test.htm"|
To add an attachment use the following:
Call clsSendMail.AddAttachment "c:\mydocuments\test.txt"
To embed files in your message use:
clsSendMail.AddRelatedBodyPart "/older/imagefile.gif", "image1.gif"
This can then be included in your HTMLBody by referencing the second parameter as the CID, for example:
You can also set a SMTP server and port if neccessary:
Call clsSendMail.SMTPServer "mail.test.com", 25
by John Avis | November 4, 2019
As support ends for Microsoft Windows Server 2008 I have recently gone through migrating some websites to a new server running Windows Server 2016 and IIS 10 but some of the websites did not work.
by John Avis | October 15, 2019
For a website project I needed a way to enter multiple tags. I just wanted something simple that I could easily modify to suit my own needs, so I wrote my own.
by John Avis | September 1, 2019
I rediscovered a bug in ASP.NET that affects RadioButtons inside repeaters. Here is my solution to the problem.