Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Sending cdosys email to multi recipients from the database

$
0
0

Hi there

Currently, when I need to send out a mailshot to our members, I feed each email address into a form's input box on the website which then automatically sends the email out through the cdosys code picking up the email address which has just been entered into the database,

However, this is such a long job to do a 1000 emails, and I would like to code it directly to the database to pick up all email addresses at once and send within five minutes.

I know I could enter all the addresses separated by a semicolon within the cdosys code, but this method is also too long winded when we have changes to the addresses - which happens for every mailshot so it defeats the object!

This is what I have tried today and done many many variations!:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><%@LANGUAGE="VBSCRIPT"%>
<head>

<title> zzzz</title>

</head>
<body bgcolor="#EEEEEE" TEXT="#000000">

<table border="0">


<%

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "nnfrance"
qry = "SELECT emaila FROM [news_alerts]"
Set RS = Conn.Execute(qry)


vemaila = RS("emaila")
vemaila = Replace(vemaila, VbCrLf, "<BR>")
If RS.EOF Then
Response.Write("No items found")
Else
Do While Not RS.EOF
Response.Write(RS.Fields("emaila").value & "<br />")

RS.MoveNext()
Loop
End If%>

<%Dim emaila
emaila = vemaila
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "Next Meeting"
myMail.From = "Organisation <info@xxx.xxxxxxxxx.com>"
myMail.To=emaila
myMail.CreateMHTMLBody "http://www.xxxxx.com/alerts/alerts_meetings.asp"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="localhost"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>


<br><br><br>

<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">
<tr><td align=right><font size=2><a href="../eng_lib/unsubscribe.asp">
Unsubscribe</a></font></td></tr>
</table>
</td><br>

<%Server.Execute("footer.asp")%></body></html>

However, all this does is list on the webpage (invisible to users) all the emails in the database field "emaila" but does not actually send the emails from the database.

I have spent a great deal of time in the last month playing around with docsys to try and send emails to multi-recipients in the database but without success.  I would be so grateful for anyone's suggestions!


Viewing all articles
Browse latest Browse all 488

Trending Articles