Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 642
Product
SMTPmail
Version
Full Version only
Title
Can I bind the MassMail method of SMTPmail to an array?
Problem
The MassMail method of SMTPmail cannot be bound to an array. This article will explain how to create an empty recordset in an ASP page that can be used in place of an array.
Solution
An array cannot be bound to SMTPmail MassMail method, but an empty recordset can be used instead. On the page that instantiates SMTPmail, create an empty recordset and add values as you would with an array. You will need to reference the adovbs.inc file in an include statement or reference the TypeLibrary in order to use enumerators such as "adVarChar". Bind this recordset to the MassMail method in the usual way.

<!--METADATA TYPE="TypeLib"
       NAME="Microsoft ActiveX Data Objects 2.6 Library"
       UUID="{00000206-0000-0010-8000-00AA006D2EA4}"
       VERSION="2.6" -->

...

'---Create an empty recordset
set objRec = Server.CreateObject("ADODB.RecordSet")

'---Define the fields
objRec.Fields.Append "FullName", adVarChar, 200
objRec.Fields.Append "Email", adVarChar, 200

'---Open it so that you can begin populating it.
objRec.Open

'---repeat the following 4 lines as necessary
'---in order to fill the recordset
objRec.AddNew
objRec("FullName") = "John Smith"
objRec("Email") = "account@domain.com"
objRec.Update

'---When the recordset is fully populated, continue with SMTPmail.
Set mailer = Server.CreateObject("SoftArtisans.SMTPMail")
mailer.MassMail (objRec)

objRec.close
set objRec = Nothing
set mailer = Nothing

Created : 5/28/2003 12:47:20 PM (last modified : 5/28/2003 12:47:04 PM)
Rate this article!
 
Comments