Mailing List with AspMail

Results 1 to 2 of 2

Thread: Mailing List with AspMail

  1. #1
    I. Rabie Guest

    Default Mailing List with AspMail

    I am trying to use Serverobjects&#039 AspMail with a mailing list. Below is the code I came up with. But what happens is that it will email the 1st reicpient fine, and then will go back and mail the 1st and 2nd recipients, and then 1st, 2nd and third recipient and so on. Please help.<BR><BR>&#060;% <BR> Dim DataConn<BR> Dim CmdSimpleSelect<BR> Dim MYSQL<BR>Message=Request.Form("mMessage")<BR>Subje ct=Request.Form("mSubject")<BR>Set Mailer = Server.CreateObject("SMTPsvg.Mailer") <BR>Set DataConn = Server.CreateObject("ADODB.Connection")<BR>Set CmdSimpleSelect = Server.CreateObject("ADODB.Recordset")<BR><BR>Data Conn.Open "DSN=hcef"<BR>MYSQL = "SELECT mEmail, mName FROM mEmail where mtestgroup=-1" <BR>CmdSimpleSelect.Open MYSQL, DataConn<BR><BR>While Not CmdSimpleSelect.EOF<BR>%&#062;<BR>&#060;%<BR> <BR> Mailer.FromName = "News"<BR> Mailer.FromAddress = ""<BR> strMailHost = "my mail server"<BR> Mailer.RemoteHost = strMailHost<BR><BR> Mailer.AddRecipient CmdSimpleSelect("mName"), CmdSimpleSelect("mEmail")<BR> Mailer.ReturnReceipt = false<BR><BR> Mailer.ConfirmRead = false<BR> Mailer.Subject = Subject<BR> Mailer.BodyText = Message<BR>if Mailer.SendMail then<BR> Response.Write "Mail sent..."<BR> else<BR> Response.Write "Mail failure. Check mail host server name and tcp/ip connection...<BR>"<BR> Response.Write Mailer.Response<BR> end if<BR> <BR> %&#062;<BR><BR>&#060;%<BR>CmdSimpleSelect.MoveNext <BR>Wend<BR> <BR>CmdSimpleSelect.Close<BR>Set CmdSimpleSelect = Nothing<BR>DataConn.Close<BR>Set DataConn = Nothing<BR>%&#062;

  2. #2
    icabod Guest

    Default RE: Mailing List with AspMail

    Put the line:<BR>Set Mailer = Server.CreateObject("SMTPsvg.Mailer") <BR>... inside your recordset loop. Otherwise, the mailing system is just ADDING to your Mailer variables, instead of replacing them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts