| Object: | SMTP Mailer |
| Syntax: | <OBJECT>.MassMail ([in] RecordSet Pointer) |
| Returns: | True/False |
| Description: | The MassMail method works like a mail merge to send e-mail messages to a mailing list with only one connection to the mail server. MassMail replaces the SendMail method. 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 %%<B>E</B>mailAddress%% as the value inside the delimiters, SMTPMail will read the column name as"<B>E</B>mailAddress", 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%%". |
<%
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
...
%>
* ONLY available in the Full version of SoftArtisans SMTPmail.
| Previous Page | Next Page |