Send to a friend script

  • madamladybug
  • Born
  • Born
  • madamladybug
  • Posts: 1
  • Loc: Dallas, TX

Post 3+ Months Ago

Having problems with my send to a friend script. Getting an error msg "Error SendingAn email has been sent to}~~..:scarlet@learnstar.com" -Maybe its the form thats having the problem or maybe it's the server. Please help. Thanks :shock:

Code: [ Select ]
<%

' email values to set in form
'--------------------------------
' SendersName
' SendersEmail
' EmailSubject
' EmailRecipient
' message-
' thanksPage




' set up email values
sendersName =Request.Form("SendersName")
sendersEmail =Request.Form("SendersEmail")
if sendersName="" then sendersName=sendersEmail

EmailSubject=Request.Form("EmailSubject")
if EmailSubject="" then EmailSubject="No Subject"

'I hardcode the email recipient but you might want this flexibility
EmailRecipient=Request.Form("EmailRecipient") ' required


if EmailRecipient="" then
    response.Write("<html><body>Sorry, recipient required!</body></html>")
    response.End
end if

message=Request.Form("message")
if message="" then message="No message"



' create email
Set objNewMail = Server.CreateObject("CDONTS.NewMail")

objNewMail.FROM = sendersName & "<" & sendersEmail & ">"
objNewMail.TO = EmailRecipient
objNewMail.Subject = Request.Form("EmailSubject")
objNewMail.Body = message & vbcrlf & vbcrlf & "Host:" & request.ServerVariables("REMOTE_ADDR") & vbcrlf & "Referer:" & request.ServerVariables("HTTP_REFERER")
objNewMail.BodyFormat = 1
objNewMail.MailFormat = 1

' send email
objNewMail.Send
Set objNewMail = Nothing

response.write(" Email has been sent to***:" & EmailRecipient )
' show thankyou page
'if not request("thanksPage")="" then
    'response.Redirect(request("thanksPage"))
'    response.write("Thank you for sending e-mail to:" & EmailRecipient )

'else
    'response.write("<html><body>Thank You!</body></html>")
    'response.write(" Email has been sent to:" & EmailRecipient )
'end if    
response.End

%>
  1. <%
  2. ' email values to set in form
  3. '--------------------------------
  4. ' SendersName
  5. ' SendersEmail
  6. ' EmailSubject
  7. ' EmailRecipient
  8. ' message-
  9. ' thanksPage
  10. ' set up email values
  11. sendersName =Request.Form("SendersName")
  12. sendersEmail =Request.Form("SendersEmail")
  13. if sendersName="" then sendersName=sendersEmail
  14. EmailSubject=Request.Form("EmailSubject")
  15. if EmailSubject="" then EmailSubject="No Subject"
  16. 'I hardcode the email recipient but you might want this flexibility
  17. EmailRecipient=Request.Form("EmailRecipient") ' required
  18. if EmailRecipient="" then
  19.     response.Write("<html><body>Sorry, recipient required!</body></html>")
  20.     response.End
  21. end if
  22. message=Request.Form("message")
  23. if message="" then message="No message"
  24. ' create email
  25. Set objNewMail = Server.CreateObject("CDONTS.NewMail")
  26. objNewMail.FROM = sendersName & "<" & sendersEmail & ">"
  27. objNewMail.TO = EmailRecipient
  28. objNewMail.Subject = Request.Form("EmailSubject")
  29. objNewMail.Body = message & vbcrlf & vbcrlf & "Host:" & request.ServerVariables("REMOTE_ADDR") & vbcrlf & "Referer:" & request.ServerVariables("HTTP_REFERER")
  30. objNewMail.BodyFormat = 1
  31. objNewMail.MailFormat = 1
  32. ' send email
  33. objNewMail.Send
  34. Set objNewMail = Nothing
  35. response.write(" Email has been sent to***:" & EmailRecipient )
  36. ' show thankyou page
  37. 'if not request("thanksPage")="" then
  38.     'response.Redirect(request("thanksPage"))
  39. '    response.write("Thank you for sending e-mail to:" & EmailRecipient )
  40. 'else
  41.     'response.write("<html><body>Thank You!</body></html>")
  42.     'response.write(" Email has been sent to:" & EmailRecipient )
  43. 'end if    
  44. response.End
  45. %>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9088
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

It seems nobody has responded to help you. Do you have your mail server setup? Are you able to use the CDONTS component? I see in your script you are using that and I am not positive you will have that installed by default. I think your script is fine, to me it sounds like the mail server.

Your ouput from the script is:

"Error SendingAn email has been sent to}~~..:scarlet@learnstar.com"

That shows that it indeed reached the line in the script that says:

"An email has been sent to}~~..:scarlet@learnstar.com"

However it looks like the words "Error Sending" was appending to the beginning of the line, and I am guessing it has something to do with CDONTS. Anyway I am not sure if you have resolved this problem by now, but would be curious if you ever did, and if not maybe some of my suggestions will push you in the right direction.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 53 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.