Sending variable values in CDO mail form

I am having trouble with CDO email forms.  I wish to send an email to the client alerting them an application has been made, I wish this email to include a message as well as variable values and a hyperlink. The problem is sending the variable values see below:      

objCDOMail.HTMLBody = "An application to an event has been posted.<br>To go straight to the application form and view the details <a href='http://www.hushclothing.co.uk/caukus.asp?appID=" + userID + "'>Click Here/a><br><br>Thank You<br><br>Caukus Alert Application System"


      
rabbits2Asked:
Who is Participating?
 
inviserCommented:
What NovoNordisk posted has the correct idea. That is that the double quotes around the href= statement are interfering with the quotes surrounding the entire literal string you are assigning objCDOMail.HTMLBody. You can either use single quotes as you see above, no quotes (since there are no spaces in the URL), or use 2 consecutive double quotes ("" is interpreted by ASP as a literal ") like this:

objCDOMail.HTMLBody = "An application to an event has been posted.<br>To go straight to the application form and view the details <a href=""http://www.hushclothing.co.uk/caukus.asp?appID=" & userID & """>Click Here</a><br><br>Thank You<br><br>Caukus Alert Application System"

NOTE: In your code and NovoNordisk's code the closing </a> tag was missing the '<' bracket (this is fixed in the code I posted). Also, in ASP you use the & operator to concatenate strings, not the + operator.
0
 
NovoNordiskCommented:
objCDOMail.HTMLBody = "An application to an event has been posted.<br>To go straight to the application form and view the details <a href='http://www.hushclothing.co.uk/caukus.asp?appID=" &userID&"' >Click Here/a><br><br>Thank You<br><br>Caukus Alert Application System"
0
 
NovoNordiskCommented:
oops - well spotted!
0
 
rabbits2Author Commented:
Thats working , thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.