Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 380
Product
SMTPmail
Title
Using SMTPmail's MassMail Feature
Solution

Note: This feature is only available in the paid version of SMTPmail.

Version 2.0 and above of SoftArtisans SMTPmail contains a powerful mass-mailing feature. This new feature works like a mail merge to send e-mail messages to a mailing list with only one connection to the mail server.

The new method used to invoke this functionality is the MassMail method.

MassMail replaces the SendMail method in your ASP code. You should not use the SendMail method if you are using the MassMail method.

MassMail sends each e-mail as it replaces the coded template with values from your data source. When creating the template in your code, use "%%" delimiter characters on each side of the column names in order to indicate which columns you would like SMTPMail to pull data from when using the MassMail feature.

For example, if you want to pull an e-mail address out of a column named "EmailAddress", you would refer to it in your code as %%EmailAddress%%. If you want to use the delimiter characters, "%%", in the subject or body of your e-mail without referring to a data source column, you should put the escape character ("\") in front of them, like this: "\%\%".

The MassMail method does not handle bounced messages.

This functionality is compatible with LSMTP.

Note:

You can use the MassMail functionality from within an HTML message or when getting the body text of a message from an HTML file, but SMTPMail will read the column name value inside delimiters literally, so you cannot use HTML formatting or any additional characters inside the delimiters. For example, if you use %%EmailAddress%% as the value inside the delimiters, SMTPMail will read the column name as "EmailAddress", will not recognize it as a valid column name and will pass it out to the body text of the e-mail as HTML-formatted text, "%%EmailAddress%%".

This feature is only available in the full version of SoftArtisans SMTPmail.

Example:
<%
Set mailer = Server.CreateObject("SoftArtisans.SMTPMail")
...
'---
'--- Set the Subject, Recipient and BodyText of the mass e-mail
mailer.Subject = "Regarding Order Number %%OrderNumber%%"
mailer.BodyText = "Dear %%FirstName%% :" & vbCrLf
...
mailer.AddRecipient "%%FirstName%% %%LastName%%", "%%EmailAddress%%"
mailer.AddCC "Mail Administrator", "webmaster@website.com"
'---
'--- Set remote host name
mailer.RemoteHost = "servername"
'---
'--- Set database connection
filePath = Server.MapPath("massmail.mdb")
strConnect = "DBQ=" & filePath & ";Driver= {Microsoft Access Driver(*.mdb)};DriverId=25;FIL=MSAccess;"
'---
Dim objRec
Dim objCommand
'---
Set objCommand = Server.CreateObject ("ADODB.Command")
Set objRec = Server.CreateObject("ADODB.Recordset")
'---
objCommand.ActiveConnection = strConnect
objCommand.CommandType = adcmdText
objCommand.CommandText = "SELECT LastName, EmailAddress, FirstName, OrderNumber FROM Customers"
Set objRec = objCommand.Execute
'---
'--- Until end of recordset is reached, send e-mail
If mailer.MassMail (objRec) Then
Response.Write "Mail sent..."
Else
Response.Write "Mail failure."
End If
'---
Set objRec = nothing
Set mailer = nothing
...
%>
Created : 12/1/2002 12:00:00 AM (last modified : 9/19/2002 7:38:33 PM)
Rate this article!
 
Comments