SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Jul 2008
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASP email help please

    Hello,


    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, a@b.com c@d.com


    How do I list the emails that store in strMail without creating a new page?


    Currently, strMail is empty.


    The strMail should store these emails in this format: a@b.com, c@d.com, so that when I open this page, it will send to 2 students.


    Can anyone please help?


    Thanks very much!

    Code:
                <%
    
                            Set oRs = Server.CreateObject("adodb.recordset")
    
                            strSQL = "        select Student_id, Dept, Student_Email " _
    
                                                    & "       from Students; "
    
                            oRs.Open strSQL, myConn
    
                %>
    
                            <form name="studentfrm" method="post">
    
                                        <%       if not oRs.eof then %>
    
                                        <%       do until oRs.eof %>
    
                                                    <%=oRs("Student_Email")%>
    
                                        <%       oRs.MoveNext
    
                                                    loop
    
                                                    End If %>                               
    
                </form>
    
    <%
    
                Dim NewMailObj, strBody, strMail
    
                            strMail             = Request.Form("strEmail")
    
                Set NewMailObj = CreateObject("CDO.message")
    
                NewMailObj.From = "Student_Report"
    
                NewMailObj.To = strMail
    
                NewMailObj.Subject = "Student Report Alert"
    
                NewMailObj.HTMLBody = "Please submit your report now" & vbCrLf
    
                            NewMailObj.Configuration.Fields.Item _
    
                            ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    
                            NewMailObj.Configuration.Fields.Item _
    
                            ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="carelay.ca.state.sbu"
    
                            NewMailObj.Configuration.Fields.Item _
    
                            ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
    
                NewMailObj.Send
    
                Set NewMailObj = Nothing
    
    %>

  2. #2
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try following:
    Code ASP:
    <%
    			Set oRs = Server.CreateObject("adodb.recordset")
     
    			strSQL = "select Student_id, Dept, Student_Email from Students"
    			oRs.Open strSQL, myConn
     
     
                Dim NewMailObj, strBody, strMail
     
                Set NewMailObj = CreateObject("CDO.message")
    			NewMailObj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    			NewMailObj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="carelay.ca.state.sbu"
    			NewMailObj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
     
                NewMailObj.From = "Your Email Address"
                NewMailObj.Subject = "Student Report Alert"
                NewMailObj.HTMLBody = "Please submit your report now"			
     
    				if NOT oRs.EOF then
    					do while NOT oRs.EOF
    						Response.Write( oRs("Student_Email") &"<br>")
     
    			            NewMailObj.To = oRs("Student_Email")
                			NewMailObj.Send
    					oRs.MoveNext
    					loop
    				end if	
     
                Set NewMailObj = Nothing
    %>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •