Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Send mail from database list

How to connect to a database and to send a mail to addresses specified in a table.


'database connection
Set objConn = Server.CreateObject("ADODB.Connection")
objRS = "dsn=Database_Nominativi"
objConn.Open objRS
Set RSEmail=objConn.Execute("Select E-mail From Nominativi")
'read all e-mails from a table
Do While not RSEmail.eof
  'send email
  Set objMail = Server.CreateObject("CDONTS.NewMail")
  objMail.From="SENDER"
  objMail.To=rsEmails("EmailAddress") 'the mail read from the database
  objMail.Subject="SUBJECT"
  objMail.Body="TEXT"
  objMail.importance=0
  objMail.Send
  Set objMail = nothing
  rsEmail.movenext
loop
set rsEmail = nothing
objConn.close
Set objConn = nothing

Download code...


Print this page


 

Inizio pagina

risorse per webmaster