PDA

View Full Version : asp forwarding script



QuizToon
08-23-2005, 10:20 PM
I run a small online quiz where the answers are sent o me via email on the click of a submit button.

I have the following script on my server which processes the information and forwards an email to me with the answers and senders information.

What I would like is for it also to send the same email to the sender, so they can check back on their answers when i publish the answers/results.

I am guessing that there will be some code that i add to the recipient partof the script.

Please could someone take a look at the script and tell me how and where i put the code

Many Thanks

Quiztoon





<%
SenderEmail = Request.Form("visitor_email_address")
Subject = "Links Quiz Answers"
Recipient = "linksquiz@quiztoon.co.uk"

'Get Time / Date

my_date = FormatDateTime(now(),1)
my_time = FormatDateTime(now(),4)

Body = "SUBMITTERS DETAILS - " & vbcrlf & vbcrlf

Body = Body & "Submitted On : " & my_date & vbcrlf
Body = Body & "Submitted At : " & my_time & " GMT" & vbcrlf
Body = Body & "Submitted By : " & Request.Form("visitor_name") & vbcrlf
Body = Body & "Email Address : " & Request.Form("visitor_email_address") & vbcrlf
Body = Body & "Senders gender : " & Request.Form("gender") & vbcrlf & vbcrlf

Body = Body & "ANSWERS SUBMITTED - " & vbcrlf & vbcrlf

Body = Body & "Answer to Question 1 : " & Request.Form("answer1") & vbcrlf
Body = Body & "Answer to Question 2 : " & Request.Form("answer2") & vbcrlf
Body = Body & "Answer to Question 3 : " & Request.Form("answer3") & vbcrlf
Body = Body & "Answer to Question 4 : " & Request.Form("answer4") & vbcrlf
Body = Body & "Answer to Question 5 : " & Request.Form("answer5") & vbcrlf & vbcrlf

Body = Body & "Answer to Link 1 : " & Request.Form("link1") & vbcrlf & vbcrlf

Body = Body & "Answer to Question 6 : " & Request.Form("answer6") & vbcrlf
Body = Body & "Answer to Question 7 : " & Request.Form("answer7") & vbcrlf
Body = Body & "Answer to Question 8 : " & Request.Form("answer8") & vbcrlf
Body = Body & "Answer to Question 9 : " & Request.Form("answer9") & vbcrlf
Body = Body & "Answer to Question 10 : " & Request.Form("answer10") & vbcrlf & vbcrlf

Body = Body & "Answer to Link 2 : " & Request.Form("link2") & vbcrlf & vbcrlf

Body = Body & "SENDERS COMMENTS : " & vbcrlf & vbcrlf & Request.Form("comments")


Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "mail.quiztoon.co.uk"
JMail.Sender = SenderEmail
JMail.Subject = Subject
JMail.AddRecipient Recipient
JMail.Body = Body
JMail.Priority = 1
JMail.Execute

Response.Redirect("thank_you.html")
%>

Twey
08-24-2005, 10:09 AM
SenderEmail = Request.Form("visitor_email_address")
Subject = "Links Quiz Answers"
Recipient = "linksquiz@quiztoon.co.uk" & ", " & SenderEmail
RFC2822 (http://www.faqs.org/rfcs/rfc2822) says you can send to multiple recipients seperated by commas.

QuizToon
08-24-2005, 12:19 PM
Thank you for that. However it doesnt work, when i hit submit i get another page showing this text.


jmail.SMTPMail error '8000ffff'

The message was undeliverable. All servers failed to receive the message

/linksquiz/process_current.asp, line 46

any other ideas or is there a place where i can actually re-write the whole script

Twey
08-24-2005, 12:50 PM
OK, try...

Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "mail.quiztoon.co.uk"
JMail.Sender = SenderEmail
JMail.Subject = Subject
JMail.AddRecipient Recipient
JMail.AddRecipient SenderEmail
JMail.Body = Body
JMail.Priority = 1
JMail.Execute

QuizToon
08-24-2005, 01:42 PM
Thanks again, but it still will not play.


jmail.SMTPMail error '8000ffff'

Error: 550 The following recipients could not be sent to:

/linksquiz/process_current.asp, line 47


line 47 or line 46 in the previous error is


JMail.Execute


Has that got anyhting to do with it?

totally flummoxed now

Twey
08-24-2005, 02:24 PM
No, that's just what's throwing the exception.
It looks to me as if SenderEmail is blank. Make sure it's being passed properly.