Results 1 to 3 of 3
Thread: ASP email cdo message help
May 11, 2011, 08:16 #1
- Join Date
- Jul 2008
- 0 Post(s)
- 0 Thread(s)
ASP email cdo message help
I posted a similar message like this last week. This is something new that I can't figure out.
I created a script to remind students to turn in their reports. Whenever I open this page, the script runs and students will receive an email to remind them to turn in their reports.
On this script, I got the emails in this format, email@example.com firstname.lastname@example.org, email@example.com
The strMail should store these emails in this format: firstname.lastname@example.org, email@example.com, firstname.lastname@example.org so that when I open this page, it will send to students who met the criteria.
Currently, the email message send each student a separate email. However, it should send an email to students who have the same ID
For example, the email should send to email@example.com and firstname.lastname@example.org on ONLY one message and the email should send to email@example.com one message.
ID Email Date
1 firstname.lastname@example.org 5/4/2011
2 email@example.com 5/4/2011 1
Can anyone please help?
Thanks very much!
<% Set oRs = Server.CreateObject("adodb.recordset") strSQL = " select Student_ID, Student_Email + '@yahoo.com' AS Email from Students Where dueDate='5/4/2011' Group By Student_ID, Student_Email, dueDate; " oRs.Open strSQL, myConn %> <br /><h2>Student_Report Reminder</h2> <% Dim NewMailObj, strBody, sMail, aEmail aEmail = aEmail & sEmail & "," if not oRs.eof then do until oRs.eof sID = oRs("Student_ID") sEmail = oRs("Email") sDate = oRs("dueDate") aEmail = aEmail & sMail & "," Set NewMailObj = CreateObject("CDO.message") NewMailObj.From = "Student_Report" NewMailObj.To = aEmail NewMailObj.Subject = "Student Report" NewMailObj.HTMLBody = "Reminder for the following students:<br><br><table><tr><td>ID</td><td>Email</td><td>Date</td></tr><tr><td>"&sID&"</td><td>"&sEmail&"</td><td>"&sDate&"</td></tr></table>" & vbCrLf NewMailObj.Send end if oRs.MoveNext loop End If %>