Connecting Tech Pros Worldwide Forums | Help | Site Map

On ASP contact pages:Embedding a hyperlink inside an email reply back

Newbie
 
Join Date: Aug 2008
Posts: 1
#1: Aug 15 '08
Hello,
I'll be upfront - I'm not a programmer. I know bits and pieces of programming and can put together html pages fairly well. I have an .asp contact page that I inherited that needs to have a link embedded into the email reply instead of the actual url showing.

Here's a sample of that portion of the current code:
Expand|Select|Wrap|Line Numbers
  1. ' Send email to customer
  2. sTo = Request("sEmail")
  3. sFrom = "info@assignmentforsuccess.com"
  4. sSubject = "Assignment for Success Newsletter Email List Confirmation"
  5. sBody = "Thank you for signing up on our email list!" & vbCrLf &_
  6.                 vbCrLf &_
  7.                 "We would like to give you a valuable free report which has proven to offer invaluable advice for making decisions on your future investments and benefits." & vbCrLf &_
  8.                 vbCrLf &_
  9.                 "Click here to get started!" & vbCrLf &_
  10.                 vbCrLf &_
  11.                 "Assignment for Success" & vbCrLf &_
  12.                 "www.assignmentforsuccess.com"
  13. set oMail = Server.CreateObject("CDONTS.NewMail")
  14. oMail.To = sTo
  15. oMail.From = sFrom
  16. oMail.Subject = sSubject
  17. oMail.Body = sBody
  18. oMail.Send
How do I embed a hyperlink for "Click here to get started" ?
Thanks for any help!
Laura

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#2: Aug 15 '08

re: On ASP contact pages:Embedding a hyperlink inside an email reply back


Hi Laura,

You can set the body of the e-mail to be HTML rather than text which will enable you to embed a link.

The first thing to do is to make a slight change to your code to replace your CDONTS mail object with a CDOSYS one. CDONTS is not used any more but it is very easy to make the change. Here's an example showing you how to use an html email body with CDOSYS:

Expand|Select|Wrap|Line Numbers
  1. sBody = ""
  2. sBody = sBody & "<p>Thank you for signing up on our email list!</p>"
  3. sBody = sBody & "<p>We would like to give you a valuable free report which has proven to offer invaluable advice for making decisions on your future investments and benefits.</p>"
  4. sBody = sBody & "<p>Click here to get started!</p>"
  5. sBody = sBody & "<p>Assignment for Success</p>"
  6.  
  7. 'Here's the embedded link
  8. sBody = sBody & "<a href='www.assignmentforsuccess.com'>Click here to get started</a>"
  9.  
  10. set oMail = Server.CreateObject("CDO.Message")
  11. oMail.To = sTo
  12. oMail.From = sFrom
  13. oMail.Subject = sSubject
  14. oMail.HTMLBody = sBody
  15. oMail.Send
Let me know how you get on,

Dr B
Reply