HTML e-mail from a file

Visual Basic Code | ASP Code

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.

[Visual Basic]:

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

[ASP]:

<%
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

 


Send feedback to AfterLogic
Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.