...

View Full Version : Multi lines in email body



wrothwell
08-07-2002, 09:25 AM
Hi,

By this:"mailto:xyz@abc.com&SUBJECT=+hellotxt&BODY=I NEED MORE THAN A SINGLE LINE!" I can invoke the client email app. to send me a message.

I wish to include several lines of information in the email body. No fancy formatting but text with line breaks. Is this possible? I tried '\n' but no luck. Any help is appreciated.


Will

glenngv
08-07-2002, 09:43 AM
mailto:xyz@abc.com&SUBJECT=hellotxt&BODY=Line1%0D%0ALine2

wrothwell
08-07-2002, 11:50 AM
Thanks very much.

I have tried to put %0D%0A in but it have no effect. I also tested with an escape char '\'. no luck either.

What I did and failed:
<script language="JavaScript1.1">
var todayTxt1 = "This is line 1";
var todayTxt2 = "This is line 2";
var p1 = "mailto:abc@xyz.com&SUBJECT=User Name: ";
p1 += "Mr. Confused";
p1 += "&BODY=";
p1 += todayTxt1;
p1 += "%0A%0D";
p1 += todayTxt2;
location = p1;
</script>

I am using IE5 and Outlook 2000.

Is it possible you can give me a few lines of examples. Thanks in advance.


Will

glenngv
08-07-2002, 11:55 AM
is this a typo, you typed & instead of ? after the email addr

<script language="JavaScript1.1">
var todayTxt1 = "This is line 1";
var todayTxt2 = "This is line 2";
var p1 = "mailto:abc@xyz.com?SUBJECT=User Name: ";
p1 += "Mr. Confused";
p1 += "&BODY=";
p1 += todayTxt1;
p1 += "%0A%0D";
p1 += todayTxt2;
location = p1;
</script>

wrothwell
08-07-2002, 12:04 PM
Hi,

On my system I do have the & and not ?.

Outlook comes out ok but without the line break. Alert box also suggests the line SUBJECT etc. ok???

How can I place a screen capture on this page?


Will

wrothwell
08-07-2002, 12:13 PM
Hi Glenn,

I might have mis-read your message. So I tried the '?' instead of '&' but it seems not making any difference when it is before the word SUBJECT=. The effect is different if it is before BODY=.



Will

crca
08-07-2002, 12:22 PM
try this:


<script language="JavaScript1.1">
function sendmail(mail, subject, body){
var todayTxt1 = "This is line 1";
var todayTxt2 = "This is line 2";
var p1 = "mailto:"
p1 += mail
p1 += "?SUBJECT=";
p1 += subject;
p1 += "&BODY=";
p1 += body;
location = p1;
}
</script>

<p><a href="javascript:sendmail('me@me.com','hello world', 'this is the body')">tim</a></p>

Just, how can i do it if i create new lines in the body?

wrothwell
08-07-2002, 01:49 PM
Yes, you're right. The problem is how to do a line break??


Will

glenngv
08-08-2002, 03:21 AM
can you post the code again?

if you alert(p1), the output should be:

mailto:abc@xyz.com?SUBJECT=User Name: Mr. Confused&BODY=This is line 1%0A%0DThis is line 2

reptilemart
08-08-2002, 04:58 AM
I found this while looking for an answer to my previous question (*hint * hint*)

here's the address:
http://www.webreference.com/js/tips/001023.html



Here's my question for those that want to give it a shot (pleaaasee)

http://www.codingforums.com/showthread.php?s=&threadid=3498

wrothwell
08-08-2002, 08:32 AM
Hi Glenn,

Here is the code I'm playing with,

<script language="JavaScript1.1">
var p1 = "mailto:abc@xyz.com?SUBJECT=User ID: ";
p1 += "Is Me";
p1 += "&BODY=";
p1 += "first line";
p1 += "%0D%0A";
p1 += "second line";
alert(p1);
location = p1;
</script>

The alert show '?' ok but I still get one line in the body. Do you have the line break? If yes, what mail client you're using. Mine is Outlook 2000.


Will :confused:

glenngv
08-08-2002, 09:44 AM
i used Netscape Messenger and it has a line break.

try reversing the hexadecimal notation to %0D%0A as what the link that reptilemart provided, says.

wrothwell
08-08-2002, 10:47 AM
All is clear now. Netscape gives me the line break but not IE 5.

Thanks for your help all along.


Cheers,

Will:thumbsup:

glenngv
08-08-2002, 11:08 AM
how did you solve it in IE5? did the reversing work?


Originally posted by wrothwell
All is clear now. Netscape gives me the line break but not IE 5.

Thanks for your help all along.


Cheers,

Will:thumbsup:

wrothwell
08-08-2002, 11:15 AM
It doesn't work no matter how I place the linefeeds. If I reserve them, Netscape 6.2.3 seems to give me an 'extra line' but IE is stubborn.

I haven't solved the problem yet.



Will

glenngv
08-08-2002, 11:33 AM
for NS6, put only %0D, newline in NS6 is only carriage return (\r) without linefeed (\n)


Originally posted by wrothwell
It doesn't work no matter how I place the linefeeds. If I reserve them, Netscape 6.2.3 seems to give me an 'extra line' but IE is stubborn.

I haven't solved the problem yet.



Will

wrothwell
08-08-2002, 11:44 AM
Thank you Glenn. It is crazy that we have to make individual browser version happy.

Will:mad:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum