I'm using the script below to send mass email from a subscriber list. Using
SQL 2K and
ASP. I have a couple questions and or concerns about performance. The function will be available to web users, to send emails to people who meet criteria in a table. My best guess would be a max of 2500 users sending 1000 emails at any give time. Since my questions are what if, I don't expect any definite answers, just observations.
Any pros or cons to using CDONTS
What If more than one person hits the "Send" button at the same time
Are emails generally put into que if server is down or something
goes wrong at time of sending, or is that batch simply lost.
What I would like is see is either a list or count of emails sent
to confirm to user that emails were actually sent. After looking at the code below, if someone could assist in this last function, it would be greatly appreciated. If a list, would like to see "Recipient - EmailAddress - Yes".
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
Dim Mailobj
Dim objMail
Dim Sender
Dim Rs
Dim RSBODY
DIM MYCONN
Dim
SQL
Dim tkey
Dim newSQL
Dim sBody
Dim xDb_Conn_Str
Dim adexecutenorecords
Dim URL, Body
URL = Request.QueryString("URL")
%>
<%
Dim HTTP_REFERRER
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Cache-Control", "no-cache"
If Not(IsObject(Session("UID"))) Then
If Session("UID") = "" Then
HTTP_REFERRER = Request.ServerVariables("URL")
If Request.QueryString <> "" Then HTTP_REFERRER = HTTP_REFERRER & "?" & Request.QueryString
Response.Redirect "login.
asp?HTTP_REFERRER=" & Server.URLEncode(HTTP_REFERRER)
End If
End If
%>
<%
sBody =
%>
<%
Set RS = Server.CreateObject("ADODB.Recordset")
Set RSBODY = Server.CreateObject("ADODB.Recordset")
set myConn = Server.CreateObject("ADODB.Connection")
key = Session("OBIT").Item("ID")
key2 = Session("OBIT").Item("Deceased")
Sender = request.Form("From_Email")
tkey = key
SQL = "SELECT * FROM GBComments WHERE (NOT (EMail IS NULL)) AND EmailSent=0 AND DeceasedID=" & tkey
RS.open
SQL,xDb_Conn_Str
Do While Not RS.eof
set mailObj = Server.CreateObject("CDONTS.NewMail")
If (Request("Format") = "Text") Then
mailObj.BodyFormat = 1
mailObj.MailFormat = 1
Else
mailObj.BodyFormat = 0
mailObj.MailFormat = 0
End If
mailObj.From = "sales@something.com("&Sender&")"
mailObj.To = RS("Email")
mailObj.Subject = Request("Subject")
mailObj.Body = sBody
mailObj.Send RS.movenext
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
Loop
myConn.Open xDb_Conn_Str
newSQL = "Update GBComments SET EmailSent=1 WHERE (NOT (EMail IS NULL)) AND EmailSent=0 AND DeceasedID=" & tkey
myConn.Execute(newSQL),,adexecutenorecords
rs.close
set rs = Nothing
myConn.close
set myConn = Nothing
%>
Thanks in advance
Ernest