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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aspmail using a database

Status
Not open for further replies.

n0795

Programmer
Jul 30, 2001
136
US
This code below works ok but I want to be able to fill the "mail.addaddress field with a bunch of email addresses from an access database.
The database is called members.mdb and the field is called email.
Any help would be great
Thanks

Set mail = Server.CreateObject("Persits.Mailsender")
Mail.Host = "A Valid mail server.com"




strTest = request.form("Test")
strTest1 = request.form("Test1")
strTest2 = request.form("Test2")
strEmail = request.form("Email")


Mail.From = strEmail
Mail.FromName = "Test"
Mail.AddAddress "I want to use a access database here to send to everyone in the data base"
Mail.AddReplyTo "My reply address@my site.com"
'Mail.AddAttachment "c:\any file"
strBodyHeader = "This is todays ." & chr(13) & chr(10) & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "Test : " & strTest & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "Test1 : " & strTest1 & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "Test2 : " & strTest2 & chr(13) & chr(10)
strBody = strBodyHeader & strBody
Mail.Subject = "Test site"
Mail.body = strBody
'Mail.Body = "Dear Fan:" & Chr(13) & Chr(10) & "Thank you for your business."


On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write &quot;Error encountered: &quot; & Err.Description
End If
%>
 
some how you need to create a loop that builds the string like so

Mail.AddAddress &quot;Email 1&quot;
Mail.AddAddress &quot;Email 2&quot;
Mail.AddAddress &quot;Email 3&quot;
Mail.AddAddress &quot;Email 4&quot;

These have to be on separate lines so it needs a carriage return line on the end

This will not work
Mail.AddAddress &quot;Email 1; Email 2; Email 3 etc


DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top