By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,866 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,866 IT Pros & Developers. It's quick & easy.

Page is not automatically sending confirmation e-mails

P: 28
Hi everyone,

I have an asp page that is not sending out the confirmation e-mails when a student completes an online registration process. Could you please take a look at the attached code and tell me what I might be doing wrong??

Thanks


Expand|Select|Wrap|Line Numbers
  1. <!--#include file="../Secure/IncludeFiles/Db.asp"-->
  2. <!--#include file="../javalib/start.asp"-->
  3.  
  4. <%
  5. teamID = Request("TeamID")
  6. SchoolID = Request("SchoolID") 
  7.  
  8. Set objCommand = Server.CreateObject("ADODB.Command")
  9.         objCommand.activeConnection = objConn
  10.   'set command object type
  11.         objCommand.CommandType = 4
  12.   'set command object stored procedure
  13.         objCommand.commandText = "SpEmailStudentList"
  14.   'set command object parameter names
  15.         objCommand.Parameters.Append objCommand.CreateParameter("TeamID",adInteger,adParamInput)
  16.         objCommand.Parameters.Append objCommand.CreateParameter("SchoolID",adInteger,adParamInput)
  17.  'set the command object parameter values
  18.         objCommand.Parameters("TeamID").Value=teamID
  19.         objCommand.Parameters("SchoolID").Value=SchoolID
  20.  
  21.   'execute the command
  22.        Set rsEmailStudentList = objCommand.execute
  23.  
  24.  
  25. Do While not rsEmailStudentList.eof
  26.  
  27.     EmailFrom = Application("AdminEmail")
  28.     EmailTo = rsEmailStudentList("EmailAddress")
  29.     EmailSubject = "JSE / Liberty Investment Challenge - " & rsEmailStudentList("Team")
  30.     EmailBody = "Hi " & rsEmailStudentList("FirstName") & " " & rsEmailStudentList("LastName") & "," & chr(13) & chr(13) 
  31.     EmailBody = EmailBody + "Thank You for registering for the JSE / Liberty Investment Challenge. " & chr(13) & chr(13) & "Your Team " & rsEmailStudentList("Team") & " has been successfully added to our system at http://schools.jse.co.za. " & chr(13) & chr(13) 
  32.     if not isnull(rsEmailStudentList("Username")) and rsEmailStudentList("Username") <> "" then
  33.         EmailBody = EmailBody + "You can now login and commence trading using:" & chr(13) & chr(13) & "username: " & rsEmailStudentList("Username") & chr(13) & "password: " &  rsEmailStudentList("Password") & chr(13) & chr(13) 
  34.     end if
  35.     EmailBody = EmailBody + "Good luck to all learners on behalf of the JSE Securities Exchange South Africa and our sponsor Liberty."
  36.     EmailBody = EmailBody + chr(13) & chr(13) 
  37.     EmailBody = EmailBody + "Should you have any queries please contact us at the email address or phone number below." & chr(13) & chr(13) 
  38.     EmailBody = EmailBody + "mailto:"&Application("AdminEmail") & chr(13) & chr(13)
  39.     EmailBody = EmailBody + "Phone Idris on  : (011) 520-7168" & chr(13)  
  40.     EmailBody = EmailBody + "Phone Desiree on : (011) 520-7116" & chr(13)  
  41.     EmailBody = EmailBody + "Phone Jenny on : (011) 520-7344" & chr(13)  
  42.  
  43.  
  44.     if EmailFrom <> "" and EmailTo <> "" and EmailSubject <> "" and EmailBody <> "" then
  45.         '-----------Start email---------------------------
  46.         Set Mailer = CreateObject("CDO.Message")
  47.           Mailer.From = EmailFrom
  48.           Mailer.To = EmailTo
  49.           Mailer.Subject= EmailSubject
  50.           Mailer.TextBody=EmailBody
  51.           Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  52.         Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "196.37.145.132"
  53.         Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  54.         Mailer.Configuration.Fields.Update 
  55.           Mailer.Send
  56.         Set Mailer = Nothing
  57.     end if
  58.  
  59.     rsEmailStudentList.movenext()
  60.  
  61. loop
  62.  
  63. Response.Redirect("Thanks.asp")
  64.  
  65. %>
  66.  
Attached Files
File Type: docx Code email.docx (16.6 KB, 317 views)
Feb 27 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.