Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003

    Question Unanswered: sending automatic emails from a database

    I would like to send subscribers daily messages and or quotes via email. in a newletter format which would include graphics and the text

    The text information has been stored in the database, how do I pull the information out of the database and have it sent directly to email addresses on a daily bases.

  2. #2
    Join Date
    Nov 2002
    San Francisco
    the easiest way is to create script, let the script read the data and send it for you.

    If you have SQL server, the script should be part of SQL scheduler.

    Cauze you post it here, I expect that you have MDB file..... so create VBS script and use schduler to run it every day....

    Also sending email is different for Outlook, Lotus Notes or pure Win2k Server Eail API. I uses here Win2k Server API. If you have Outlook, let me know and I can change it.

    there are two ways....

    first you go through list of recipients and send to each a letter, the other (and I like it more) is to send one letter to everybody. In this case you have to create query, where all users are sticked into one field and text of the email to the other.

    note: you don't need to have MS Access installed on the server.

    this should work in script.....

    myConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=c:\somepath\myDb.mdb;" & _
    "User Id=admin;" & _

    Set myRecSet = CreateObject("ADODB.Recordset")

    myRecSet.Open "SELECT * FROM qryList ", myConnection, adOpenStatic, adLockReadOnly

    Do While Not myRecSet.EOF
    'here you stick sending piece....
    'it is different for Outlook, Lotus Notes or basic Win2k Server Email API
    Set objCDOMail = CreateObject("CDONTS.NewMail")
    objCDOMail.From = ""
    objCDOMail.To = myRecSet.Fields("UsersEmailsGroupofEmails")
    objCDOMail.Subject = "Here is your newsletter"
    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0
    'Set the mail format (0=MIME 1=Text)
    objCDOMail.MailFormat = 0
    objCDOMail.Body = myRecSet.Fields("BodyOfTheEmailinHTMLFormat")
    Set objCDOMail = Nothing

    Last edited by playernovis; 02-06-03 at 11:27.

Posting Permissions

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