HTML e-mail from a file (MailBee Objects Tutorials)

From AfterLogic Wiki

Jump to: navigation, search

The sample sends HTML e-mail exported from an HTML file.

If the HTML file contains references to images, scripts, CSS files and other objects, they will be embedded with the e-mail as inline attachments.

SMTP.ImportBodyText is a key property of the sample.

For simplicity, SMTP authentication is not used and no error-checking is performed.

Dim objSMTP
 
' Create mailer component
Set objSMTP = CreateObject("MailBee.SMTP")
 
' Unlock SMTP component
objSMTP.LicenseKey = "put your license key here"
 
' Set SMTP server name
objSMTP.ServerName = "mail.server.com"
 
' Set message properties
objSMTP.FromAddr = "me@mydomain.com"
objSMTP.ToAddr = "you@yourdomain.com"
objSMTP.Subject = "Message in HTML format"
 
' Export an HTML file into the e-mail message
objSMTP.ImportBodyText "C:\docs\letter.htm", True
 
' Send it!
objSMTP.Send
<%
Dim objSMTP
 
' Create mailer component
Set objSMTP = Server.CreateObject("MailBee.SMTP")
 
' Unlock SMTP component
objSMTP.LicenseKey = "put your license key here"
 
' Set SMTP server name
objSMTP.ServerName = "mail.server.com"
 
' Set message properties
objSMTP.FromAddr = "me@mydomain.com"
objSMTP.ToAddr = "you@yourdomain.com"
objSMTP.Subject = "Message in HTML format"
 
' Export an HTML file into the e-mail message
objSMTP.ImportBodyText "C:\docs\letter.htm", True
 
' Send it!
objSMTP.Send
%>

See Also:
Send Method