Thread Title: Loop through a recordset and display the Values in an Email Message.

Thread Description (By: Carrzkiss):

<%@LANGUAGE="VBSCRIPT"%>
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("Q_24421372.mdb") & ";"
objConn.Open

Set RsOutstanding=CreateObject("ADODB.RecordSet")
getSQL = "SELECT * FROM dbo WHERE DisplayStatus = 2"
RsOutstanding.Open getSQL, objConn, 1, 1, 1

%>

<%

' ******** E NAG FOR HR Question and Answers Web ************

Response.write("&nbsp;&nbsp;&nbsp; eNAG Notices Sent Include:<BR>**************************************<BR>")

'If RsOutstanding_total <> "0" Then
'response.write("Q&quot;A Site<BR>")

Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.domain.net"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update

Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "webmaster@domain.com"
objCDOSYSMail.To = "ee@domain.com"
'objCDOSYSMail.BCC = "webmaster@company.com"
objCDOSYSMail.Subject = "Q&A Report"

objCDOSYSMail.HTMLBody = "&nbsp;Hello Bob,<BR><BR>This is your daily reminder that there are currently <B> " & RsOutstanding_total & " </B> questions in the Question and Answer Web that require your attention.<BR><BR>The following question(s) requires your attention.<BR><BR><B>"

objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "QUESTIONS HERE<BR><BR>"

While Not RsOutstanding.EOF
objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & (RsOutstanding("Question")) & "<br>" & "<br>"
RsOutstanding.MoveNext
Wend

objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "<br/><br/> I hope this will work. we will see here in a minute.<BR><BR>"
objCDOSYSMail.HTMLBody = objCDOSYSMail.HTMLBody & "</B>Please Login to the Web Site at <a href=http://www.site.com/admin>http://www.site.com/admin</a> and reply to them as soon as possible.<BR><BR>Thank you.<BR><BR><BR>****************************************************<BR><B><I>This email was automatically generated by the Web Server</I></B>."

objCDOSYSMail.Send

Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing

'Else
'response.write ("No Reminder emails need to be sent")
'End IF
%>
<%
RsOutstanding.Close()
Set RsOutstanding = Nothing
%>


Q_24421372
Sorry, there is no Demo for this Article
Download Code (Some codes do not have .zip files with them, sorry!)


This Thread has been viewed: [ 506 ] times

Visit Carrzkiss of Experts Exchange at the following locations.
CFF Coding Source
=>Coding Source
Coding Source is a site designed for sharing of source codes, from different forms of software.
With over 100 Members and growing nearly every day!
Knowledge Base<=
Our Knowledge Base, is packed full of information to help you overcome your coding and trouble shooting issues.

Designed by: EE's very own Carrzkiss.
You know Carrzkiss from his reputation on Experts Exchange, now see his work in action.

Join the new Image Hosting site: PicDrive.net Free 500MB Account (Paid account coming soon)
EE.CFFCS.COM is Brought to you
by: CFFCS.COM - Carrz-Fox-Fire Coding Source) A ®Carrz-Fox-Fire Promotions©2000-2017 Company