Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line breaks in body of email 1

Status
Not open for further replies.

jimmythegeek

Programmer
May 26, 2000
770
US
Below is a section of code I have in an .asp page. Everything works great except that I can't get the body of the e-mail to recognize the line feeds or breaks:

==========
strSubject = "Executive Summary for " & rs("ProjName")
strBody1 = "Click the following link to view the Executive Status Report for this project"
strBody2 = " & project & "1"

Response.Write &quot;<A href='mailto:?Subject=&quot; & strSubject & &quot;&body=&quot; & strBody1 & chr(10) & strBody2 & &quot;'>Email this summary</A>&quot;
==========
I have also tried the following:
strBody1 & &quot;<BR>&quot; & strBody2
strBody1 & chr(10) & chr(13) & strBody2

None of which breaks the strings into seperate lines. Any suggestions? Thanks in advance.
Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Hi Jim,

Try this:

strBody1 & &quot;%0d&quot; & strBody2

Hope this helps,
Erik
 
Jim,

The problem you are having is that the browser is parsing the chr() command. You can see this if you view source. I tried to get it to work by enclosing the chr() command in quotes, but it just renders those characters to the email. I worked on it for a while, but couldn't find a fix.

Hopefully this little hint might help..

Sorry :-(

ToddWW
 
Thank you for your responses.

Erik, unfortunately that did not work.

I will continue to look for a work around, if either one of you come up with something, let me know.

Thanks again
Jim Jim Lunde
compugeeks@hotmail.com
We all agree that your theory is crazy, but is it crazy enough?
 
Hi Jim,

:) hmmm I did a lot of typing but while submitting my post I got an error 404 !! so now I have to type it all over again.

It must work Jim this %0d

It’s %the number zerod and [red]not[/red] %the letter Od

And I’m not alone, see also faq215-926

I also worked sometimes with ASP and for me server.URLEncode() wil work too.
...strBody1 & server.URLEncode(&quot;%0d&quot;) & strBody2...
So don’t give up, keep on trying !!!

Just try this example in plain HTML to see that it wil work:

<A href=&quot;mailto:?Subject=Executive Summary for YourRecordField&body=Click the following link to view the Executive Status Report for this project%0d
Code:
[URL unfurl="true"]http://seattle/test/maximus/ProjectDetail.asp?projectid=[/URL]
&quot;>Email this summary</A>

Further I have some remarks/tips:

nr.1
I saw a “;” in your code in strBody2 (...projid=&quot;; & proj&quot;...) I don’t think it belongs there, but it can also be generated by this post on Tek-tips????

nr.2
Your link in the body is displayed as:
instead of:

I also tried server.URLEncode() here. Split strBody in 2 parts:
strBody2a =
Code:
&quot;[URL unfurl="true"]http://seattle/test/maximus/ProjectDetail.asp&quot;[/URL]
strBody2b =
Code:
&quot;projid=&quot; & project & &quot;1&quot;

and code your response write like (the %3F gives a ?):

Response.Write(&quot;<A href='mailto:?Subject=&quot; & strSubject & &quot;&body=&quot; & strBody1 & server.URLEncode(&quot;%0d&quot;) & strBody2a & server.URLEncode(&quot;%3F&quot;) & strBody2b & &quot;'>Email this summary</A>&quot;)

Hope this helps,
Erik
 
Erik,

You are definitely &quot;The Man&quot;.

The server.URLEncode(&quot;%0d&quot;) worked perfectly.

Also, the &quot;;&quot; in your nr.1 is not there in my code, it must have been generated.

It works great, and if I could give you more than 1 star I would.

Thanks alot!! Jim Lunde
compugeeks@hotmail.com
We all agree that your theory is crazy, but is it crazy enough?
 
Your welcome :)

Did the server.URLEncode(&quot;%3F&quot;) also work ? I'm verry currious about that.

Erik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top