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
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
Code:
<!--#include file="../Secure/IncludeFiles/Db.asp"-->
<!--#include file="../javalib/start.asp"-->
<%
teamID = Request("TeamID")
SchoolID = Request("SchoolID")
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.activeConnection = objConn
'set command object type
objCommand.CommandType = 4
'set command object stored procedure
objCommand.commandText = "SpEmailStudentList"
'set command object parameter names
objCommand.Parameters.Append objCommand.CreateParameter("TeamID",adInteger,adParamInput)
objCommand.Parameters.Append objCommand.CreateParameter("SchoolID",adInteger,adParamInput)
'set the command object parameter values
objCommand.Parameters("TeamID").Value=teamID
objCommand.Parameters("SchoolID").Value=SchoolID
'execute the command
Set rsEmailStudentList = objCommand.execute
Do While not rsEmailStudentList.eof
EmailFrom = Application("AdminEmail")
EmailTo = rsEmailStudentList("EmailAddress")
EmailSubject = "JSE / Liberty Investment Challenge - " & rsEmailStudentList("Team")
EmailBody = "Hi " & rsEmailStudentList("FirstName") & " " & rsEmailStudentList("LastName") & "," & chr(13) & chr(13)
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)
if not isnull(rsEmailStudentList("Username")) and rsEmailStudentList("Username") <> "" then
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)
end if
EmailBody = EmailBody + "Good luck to all learners on behalf of the JSE Securities Exchange South Africa and our sponsor Liberty."
EmailBody = EmailBody + chr(13) & chr(13)
EmailBody = EmailBody + "Should you have any queries please contact us at the email address or phone number below." & chr(13) & chr(13)
EmailBody = EmailBody + "mailto:"&Application("AdminEmail") & chr(13) & chr(13)
EmailBody = EmailBody + "Phone Idris on : (011) 520-7168" & chr(13)
EmailBody = EmailBody + "Phone Desiree on : (011) 520-7116" & chr(13)
EmailBody = EmailBody + "Phone Jenny on : (011) 520-7344" & chr(13)
if EmailFrom <> "" and EmailTo <> "" and EmailSubject <> "" and EmailBody <> "" then
'-----------Start email---------------------------
Set Mailer = CreateObject("CDO.Message")
Mailer.From = EmailFrom
Mailer.To = EmailTo
Mailer.Subject= EmailSubject
Mailer.TextBody=EmailBody
Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "196.37.145.132"
Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Mailer.Configuration.Fields.Update
Mailer.Send
Set Mailer = Nothing
end if
rsEmailStudentList.movenext()
loop
Response.Redirect("Thanks.asp")
%>