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 = "firstname.lastname@example.org" clsSendMail.From = "email@example.com" 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 | March 21, 2017
I recently needed to change a client's website to send emails using Amazon SES and encountered a few issues.
by John Avis | June 8, 2016
Although probably no one cares about Classic ASP, except those who still need to support it, I was refreshing my memory today on how to use classes in Classic ASP and found a couple of options for simulating constructors with parameters.
by John Avis | July 31, 2015
As of July 2015, many of my Classic ASP websites have started logging strange errors, either 80004005 or not reporting any error code at all.