Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPemail

Status
Not open for further replies.

n0795

Programmer
Jul 30, 2001
136
0
0
US
This code is supposed to work but doesnt all I get is cannot relay.
My mail server is set up ok ,its just that when i connect to a database i get the error.
If i just send one email it goes ok.
What i want is another way to update the mail.AddBcc field with data from a data base some type of loop I guess.
<%
strHost = &quot;a valid smtp host.com&quot;
%>

<%

strDbPath = Server.MapPath(&quot;.&quot;) & &quot;\users.mdb&quot;
ConnectStr = &quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=&quot; & strDbPath

Set rs = Server.CreateObject(&quot;adodb.recordset&quot;)
rs.Open &quot;users&quot;, ConnectStr, 2, 3

If Request(&quot;Send&quot;) <> &quot;&quot; Then
Set Mail = Server.CreateObjec(&quot;Persits.MailSender&quot;)
Mail.Host = strHost

Mail.From = &quot;myemail@myemail.com&quot;
Mail.FromName = &quot;AspEmail Demo&quot;
Mail.Subject = Request(&quot;Subject&quot;)
Mail.Body = Request(&quot;Body&quot;)

BCC field
While not rs.EOF
Mail.AddBcc rs(&quot;email&quot;)
rs.MoveNext
Wend
Mail.Send

Response.Write &quot;Success!&quot;
Else
Response.Write &quot;<B>Currently in the user database:</B><P>&quot;
While not rs.EOF
Response.Write rs(&quot;name&quot;) & &quot; (&quot; & rs(&quot;email&quot;) & &quot;)<BR>&quot;
rs.MoveNext
Wend
End If
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top