Programming in .ASP

R

Ryan

the variables in the URL are populate above and are valid. when I send the
email to myself or other local developers, no issue, the URL is correct,
however, sometimes when sent to customers, the url will read:

http://www.someurl.com/?name=Me&location=there&em [email protected]&hash=ABCABC123

where does the %0D%0A%20 come from, what adds that to the url, which
obviously makes it invalid and doesn't work for the customer. Any ideas would
be great.

iConf = Server.CreateObject("CDO.Configuration")

iConf.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2;

iConf.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "localhost";
iConf.Fields.Update();

objCDOMail = Server.CreateObject("CDO.Message");
objCDOMail.Configuration = iConf;

objCDOMail.To = someEmailAddress
objCDOMail.From = anotherEmailAddress
objCDOMail.Subject = "This is a subject"
body = "Hi there,\n\n"
body = body + "this is the message body "
body = body + "yadda yadda and so on\n\n"
url = "http://www.someurl.com/?name=" + name + "&location=" +
location + "&email=" +email + "&hash=" + hash
body = body + "<a href=\"" + url + "\">Here is the link to the
url</a>\n\n"
objCDOMail.HTMLBody = body
objCDOMail.Send();

objCDOMail = null;
iConf = null;
 
S

Stuart McCall

Ryan said:
the variables in the URL are populate above and are valid. when I send the
email to myself or other local developers, no issue, the URL is correct,
however, sometimes when sent to customers, the url will read:

http://www.someurl.com/?name=Me&location=there&em [email protected]&hash=ABCABC123

where does the %0D%0A%20 come from, what adds that to the url, which
obviously makes it invalid and doesn't work for the customer. Any ideas
would
be great.

iConf = Server.CreateObject("CDO.Configuration")

iConf.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2;

iConf.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "localhost";
iConf.Fields.Update();

objCDOMail = Server.CreateObject("CDO.Message");
objCDOMail.Configuration = iConf;

objCDOMail.To = someEmailAddress
objCDOMail.From = anotherEmailAddress
objCDOMail.Subject = "This is a subject"
body = "Hi there,\n\n"
body = body + "this is the message body "
body = body + "yadda yadda and so on\n\n"
url = "http://www.someurl.com/?name=" + name + "&location=" +
location + "&email=" +email + "&hash=" + hash
body = body + "<a href=\"" + url + "\">Here is the link to the
url</a>\n\n"
objCDOMail.HTMLBody = body
objCDOMail.Send();

objCDOMail = null;
iConf = null;

The %0D%0A%20 represents carriage-return, linefeed and a space. Just why
this is being embedded I'm not sure, but you could try using the ampersand
to do your string concatenation rather than plus:

url = "http://www.someurl.com/?name=" & name & "&location=" & location &
"&email=" & email & "&hash=" & hash

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top