У меня есть классический набор записей ASP, который извлекает, зацикливает и отправляет электронную почту, используя CDONTS. Проблема, с которой я сталкиваюсь, заключается в том, что, поскольку набор записей перебирает код, пользователи получают свои собственные электронные письма и сообщения всех остальных.
Я не пытался решить эту проблему, однако мне интересно, может быть, есть ли способ приостановить цикл во время итерации, чтобы гарантировать, что каждое электронное письмо отправляется одновременно.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<meta http-equiv="Refresh" content="5;url=young_eagles_volunteers.asp?YEEventID=<% REQUEST("YEEventID") %>">
<title>Young Eagles Confirm Participation</title>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body class="body">
<%
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
objConfig.Fields.Update
Set objMail=CreateObject("CDO.Message")
Set objMail.Configuration=objConfig
objMail.From="ye@eaa309.club"
objMail.ReplyTo=""
DIM conn, sql, str_YEEventID
str_YEEventID = REQUEST("YEEventID")
SET conn = SERVER.CREATEOBJECT("ADODB.Connection")
conn.OPEN eaa309
set rsYEReminder=Server.CreateObject("ADODB.recordset")
sql=("EXEC [dbo].[sp_select] @yeEventID = "&str_YEEventID&"")
rsYEReminder.Open sql,conn
IF NOT rsYEReminder.EOF AND NOT rsYEReminder.BOF THEN
DO WHILE NOT rsYEReminder.EOF
HTML = HTML & "<HTML>"
HTML = HTML & "<HEAD>"
HTML = HTML & "<TITLE>Reminder</TITLE>"
HTML = HTML & "<link href='/main.css' rel='stylesheet' type='text/css' />"
HTML = HTML & "</HEAD>"
HTML = HTML & "<BODY>"
HTML = HTML & "<img alt='EAA' src='images/YEPart_Reminder.png' border='0'><br><br>"
HTML = HTML & "<span class='bodysmall'><b>ATTENTION:</b> Volunteer("& rsYEReminder("Full Name") &" - "& rsYEReminder("YEE_VOLUNTEER_TYPE") & ") Please respond by clicking either the Yes or No buttons below if you are still planning on participating in the upcoming Young Eagles Event at "& rsYEReminder("YE_Event_Location_Name") & "</span><br><br>"
HTML = HTML & "<a href=''><img alt='EAA' src='images/yes_button.png' border='0'></a><br><br>"& vbCrlf
HTML = HTML & "<a href=''><img alt='EAA' src='images/no_button.png' border='0'></a><br><br>"& vbCrlf
IF rsYEReminder("YP Status") = "Expired" THEN
HTML = HTML & "<span class='note'>NOTE: It appears that your Youth Protection Certification has expired. Prior to the event please log into your EAA account by clicking on this link: <a href='accountlogin' target='_blank'></a> Then click My Account and then Training Information - Go to training. When you have completed your training please send an email to the current YE coordinator or chapter secretary. Thank you!</span><br><br>"
ELSEIF rsYEReminder("Status") = "Not Taken" THEN
HTML = HTML & "<span class='note'>NOTE: It appears that you've not taken the EAA Youth Protection Certification training course. Prior to the event please log into your EAA account by clicking on this link: <a href='accountlogin' target='_blank'></a> Then click My Account and then Training Information - Go to training. When you have completed your training please send an email to the current YE coordinator or chapter secretary. Thank you!</span><br><br>"
END IF
HTML = HTML & "<hr>"
HTML = HTML & "</BODY>"
HTML = HTML & "</HTML>"
objMail.To=rsYEReminder("Email")
objMail.Bcc="kbnetguy@gmail.com"
objMail.Subject="EAA CHapter Young Eagle Reminder"
objMail.HTMLBody=HTML
objMail.Send
rsYEReminder.MOVENEXT
LOOP
END IF
%>
</body>
</html>
Каждому человеку должно быть отправлено только одно индивидуальное электронное письмо. Ни один пользователь не должен получать более одного электронного письма, предназначенного для других пользователей, на основе набора записей.