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

VBscript + SQL to send emails

Status
Not open for further replies.

plshelpme

Programmer
Nov 1, 2001
27
CA
Can you write a VBscript program that pulls records from an SQL DB table and based on the information it obtains compiles personalized emails and sends them off to multiple recipients??

I know this can be done from a website....but my real question is can this be done without the website? And if so, how is the code run (where)???

Thanks.

Anna
 


anna,

Yes this is possible. Connecting to the database and looping through your recipients address is what you want to do.

If you will be mailing from the web server, you could use CDONTS.

Sample:

Set objMail = CreateObject("CDONTS.Newmail")
objMail.From = "myname@myaddress.com"
objMail.To = "recipient1@recipientaddress.com"
objMail.Cc = "ccperson@ccaddress.com"
objMail.Bcc ="bccperson@bccaddress.com"
objMail.Subject = "Your subject here"
objMail.Body = "Test message here"
objMail.AttachFile "c:\temp\attachment.bmp", "my attachment"
objMail.Send
Set objMail = Nothing


fenghsui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top