By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,417 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,417 IT Pros & Developers. It's quick & easy.

CDOSYS email - create hyperlink in body?

P: n/a
Hello,

How can you create a hyperlink in the HTML body of CDOsys email? Line 7
is a link for yahoo.com, but the asp page does not work.

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject ="Test Page - File upload"
objMessage.Sender = "" & Request.Form("email1") & ""
objMessage.To ="ja***@yahoo.com"
objMessage.HTMLBody = "Email: " & Request.Form("email1") & vbCrLf & _
"Confirmation #: " & Request.Form("ConfirmID") & vbCrLf & _
"<a href="http://yahoo.com.com/">yahoo</a>" & vbCrLf & _
"FileName: " & Request.Form("file1") & vbCrLf & _
"Name: " & Request.Form("Name") & vbCrLf

Thanks,
Jason

Aug 31 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
" is a string delimiter. When you say myString = "foo"bar" the string ends
at the second ", then VBScript will crap out due to a syntax error, because
it doesn't understand why you have added more text after you have closed the
string.

Usual workarounds:

double them up to escape them :
MyString = "<a href=""http://www.foo.com/"">"
use single quotes :
MyString = "<a href='http://www.foo.com/'>"
don't use them, since they are only necessary if someone is validating the
document :
MyString = "<a href=http://www.foo.com/>"

(Typically, "does not work" is not enough information for us to figure this
out. In the future, please define "does not work" by providing a specific
error message and highlighting the relevant line in your code.)


"Beefminator" <jk*********@cfl.rr.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
Hello,

How can you create a hyperlink in the HTML body of CDOsys email? Line 7
is a link for yahoo.com, but the asp page does not work.

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject ="Test Page - File upload"
objMessage.Sender = "" & Request.Form("email1") & ""
objMessage.To ="ja***@yahoo.com"
objMessage.HTMLBody = "Email: " & Request.Form("email1") & vbCrLf & _
"Confirmation #: " & Request.Form("ConfirmID") & vbCrLf & _
"<a href="http://yahoo.com.com/">yahoo</a>" & vbCrLf & _
"FileName: " & Request.Form("file1") & vbCrLf & _
"Name: " & Request.Form("Name") & vbCrLf

Thanks,
Jason

Aug 31 '06 #2

P: n/a
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject ="Test Page - File upload"
objMessage.Sender = "" & Request.Form("email1") & ""
objMessage.To ="ja***@yahoo.com"
objMessage.HTMLBody = "Email: " & Request.Form("email1") & vbCrLf & _
"Confirmation #: " & Request.Form("ConfirmID") & vbCrLf & _
"<a href="http://yahoo.com.com/">yahoo</a>" & vbCrLf & _
"FileName: " & Request.Form("file1") & vbCrLf & _
"Name: " & Request.Form("Name") & vbCrLf
Your quotes are wrong...try this:

"<a href='http://yahoo.com.com/'>yahoo</a>" & vbCrLf & _

Brian

Aug 31 '06 #3

P: n/a
Hey Brian,

That was it. I am still a young grasshopper. I appreciate your time.

Jason

Aug 31 '06 #4

P: n/a
Hey Brian,

That was it. I am still a young grasshopper. I appreciate your time.

Jason

Aug 31 '06 #5

P: n/a
In the HTMLbody of CDO message, can field be added in hyperlink
address? I can't get this to work:

"<a href="""" & Request.Form(""file1"") & """">U-1162 form</a><br>" &
vbCrLf & _

Thanks,
Jason

Sep 1 '06 #6

P: n/a

Beefminator wrote:
In the HTMLbody of CDO message, can field be added in hyperlink
address? I can't get this to work:

"<a href="""" & Request.Form(""file1"") & """">U-1162 form</a><br>" &
vbCrLf & _
You should only double up on quotes if you want them to appear as part
of a literal string.

"<a href=""" has an opening double quote to tell the parser that
everything that follows is part of a string. Then there is the doubled
double quote that tell the parser to parse a literal double quote,
followed by a double quote to close the string (3 in total - not 4).
Then you concatenate the value of a variable - Request.Form("file1").
Since you have broken out of the string literal at this point, you
should not be doubling quotes around file1.

After the second ampersand (&), you start a new string literal with a
double quote, and immediately want to include a literal double quote,
so you need to double it again. That's 1 for opening the string, and 2
for the double quote, which totals 3 double quotes - not 4 as you have.

Here's how it should appear:

"<a href=""" & Request.Form("file1") & """>U-1162 form</a><br>" &
vbcrlf & _

Alternatively, you can replace the doubled double quote with the chr()
function (34 is the ascii character for a double quote):

"<a href=" & chr(34) & Request.Form("file1") & chr(34) & ">U-1162
form</a><br>" & vbcrlf & _

Hope this make sense.

--
Mike Brind

Sep 1 '06 #7

P: n/a
Beautiful Mike..just beautiful..you have showed me the light...

Thanks again for your time,
Jason

Sep 2 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.