473,568 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding linebreak in mailto body

Hi everyone,

I'm setting the body of an email using values from a form

firstname = bob
lastname = dole

ebody = 'First Name: ' + firstname + '\r\n' + 'Last Name: ' + lastname

window.location .href = 'mailto:my***** @mycompany.com? subject=test
email&body=' + ebody;

If I do an "alert(ebod y);" I get the linebreak between firstname &
lastname, however when it opens up outlook, the entire ebody string
appears without a linebreak in the email body.

I've tried just \n also. is there something that can give be a line
break?
Jul 20 '05 #1
15 24722
In article <f7************ **************@ posting.google. com>,
st************* *@hotmail.com (nAmYzArC) writes:
Hi everyone,

I'm setting the body of an email using values from a form


http://www.allmyfaqs.com/faq.pl?Email_form_data

http://www.isolani.co.uk/articles/mailto.html

If you want to reliably send email, send it from the server.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #2
> If you want to reliably send email, send it from the server.

This is not a requirement stated in my original question. I am well
aware of the advantages of sending email server-side. But thanks for
the input anyway.
Jul 20 '05 #3
In article <f7************ **************@ posting.google. com>,
st************* *@hotmail.com says...
If you want to reliably send email, send it from the server.


This is not a requirement stated in my original question. I am well
aware of the advantages of sending email server-side. But thanks for
the input anyway.

Well using mailto to GENERATE a message is bogus to say the least and only
amateurs do it.

My suggestion would be to either...

1. Let the user CREATE the body and don't worry about adding any CR/LF
2. Use an some server component such as ASPMail to do it for you.

Jul 20 '05 #4
In article <f7************ **************@ posting.google. com>,
st************* *@hotmail.com (nAmYzArC) writes:
If you want to reliably send email, send it from the server.


This is not a requirement stated in my original question. I am well
aware of the advantages of sending email server-side. But thanks for
the input anyway.


Then one can safely assume that you are aware that your approach to trying to
send it client-side is very flawed? If its an intranet environment, where you
know Outlook is the default email client, then you can approach it differently.
Short of that, if its a web-based approach, then you need to rethink your
approach.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #5
In article <f7************ **************@ posting.google. com>,
st************* *@hotmail.com says...
Hi everyone,

I'm setting the body of an email using values from a form

firstname = bob
lastname = dole

ebody = 'First Name: ' + firstname + '\r\n' + 'Last Name: ' + lastname

window.location .href = 'mailto:my***** @mycompany.com? subject=test
email&body=' + ebody;

If I do an "alert(ebod y);" I get the linebreak between firstname &
lastname, however when it opens up outlook, the entire ebody string
appears without a linebreak in the email body.

I've tried just \n also. is there something that can give be a line
break?

On another note...

Outlook doesn't understand \r\n means CR/LF...

Try using:

ebody = 'First Name: ' + fromCharCode(10 ) + fromCharCode(13 ) +
'Last Name: ' + lastname;
instead.
Jul 20 '05 #6
rh
"Vjekoslav Begovic" <vj*******@inet .hr> wrote in message news:<bh******* ***@sunce.iskon .hr>...
<snip>

It's an HTML issue. Put: ebody = 'First Name: ' + firstname + '%0D' + 'Last
Name: ' + lastname
You may also want to check this article:
http://www.itworld.com/nl/html_tutor/03122002/


That article appears to have dropped a character in describing the
escape sequence for \r\n -- it has "%0D%0" where "%0D%0A" was
apparently intended.

Since Javascript provides an "escape" function, would it not be
preferable to simply escape the text, and avoid the special code
arcana?

../rh
Jul 20 '05 #7
Hi,

Vjekoslav Begovic wrote:
"nAmYzArC" <st************ **@hotmail.com> wrote in message
news:f7******** *************** ***@posting.goo gle.com...
Hi everyone,

I'm setting the body of an email using values from a form

firstname = bob
lastname = dole

ebody = 'First Name: ' + firstname + '\r\n' + 'Last Name: ' + lastname

window.locati on.href = 'mailto:my***** @mycompany.com? subject=test
email&body= ' + ebody;

If I do an "alert(ebod y);" I get the linebreak between firstname &
lastname, however when it opens up outlook, the entire ebody string
appears without a linebreak in the email body.

I've tried just \n also. is there something that can give be a line
break?

It's an HTML issue. Put: ebody = 'First Name: ' + firstname + '%0D' + 'Last
Name: ' + lastname
You may also want to check this article:
http://www.itworld.com/nl/html_tutor/03122002/


I can not believe that you, in a technical newsgroup, post a link to an
article praising a technique so deeply flawed that using it is like
throwing a stone in a well and hoping to receive an answer by email.

If the well is inhabited by a dwarf who happens to have an internet
connection, and that by chance your email address is written on the
stone, you might actually receive an email back. Using mailto: as
described in this "article" has approximately the same amount of chances
to work like you expect it.

It cannot be stressed enough: Using mailto with anything else than an
email address doesn't work reliably enough that it's worth even
mentioning it. Just forget it, it doesn't work. What's worse is: When it
doesn't work, you cannot have any feedback from your users, since they
cannot send you any email.

If you don't have any access to CGI (like the excellent, and free,
formmail for example), then use a free service provider, for example
Bravenet.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #8
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
message news:bi******** **@rex.ip-plus.net...
I can not believe that you, in a technical newsgroup, post a link to an
article praising a technique so deeply flawed that using it is like
throwing a stone in a well and hoping to receive an answer by email.
That article describes the use of mailto link, and OP wants to use mailto
link. Why he wants to do that, that's not my problem.
If the well is inhabited by a dwarf who happens to have an internet
connection, and that by chance your email address is written on the
stone, you might actually receive an email back. Using mailto: as
described in this "article" has approximately the same amount of chances
to work like you expect it.

It cannot be stressed enough: Using mailto with anything else than an
email address doesn't work reliably enough that it's worth even
mentioning it. Just forget it, it doesn't work. What's worse is: When it
doesn't work, you cannot have any feedback from your users, since they
cannot send you any email.

If you don't have any access to CGI (like the excellent, and free,
formmail for example), then use a free service provider, for example
Bravenet.


OK, but OP asked <cite>is there something that can give be a line
break?</cite>.

Jul 20 '05 #9
Whoa people -
There seems to be alot of un-needed debate here.
Let me try to simplify things:

1) I AGREEE that using server site mailing is the way to go.

2) I have a REQUREMENT to use only .htm pages. (NO server-side
programming is allowed. A mailto link seemed to be the only logical
route given the requirements.)

3) My question was NOT "Server-side vs Client-side mail. pros/cons?".
It was:
"How do i add a LINEBREAK in a mailto body"

Honestly, I like seeng some healthy debate on subjects, but in this
case, when I came back to the thread the conversation amused me and
seemed somewhat like the following:

Me: "I need bananas. Where can I find a place near me that sells
bananas?"

Vjekoslav: "Down the street, to your right." - original question
ANSWERED!!!!

Everyone else: "Why not have an Apple instead? They have more vitamins
and less calories. Apples are the way to go. Also, fruit is not the
way to go. Veggies instead have no seeds yada yada.." - original
question remains unanswered, AND topic changes!!!

P.S. I am not a fruit/vegetable expert. I do not take any
responsibility for any adverse effects on anyone's health based on my
fruit & vegetable commentary. :)

"Vjekoslav Begovic" <vj*******@inet .hr> wrote in message news:<bi******* ***@sunce.iskon .hr>...
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
message news:bi******** **@rex.ip-plus.net...
I can not believe that you, in a technical newsgroup, post a link to an
article praising a technique so deeply flawed that using it is like
throwing a stone in a well and hoping to receive an answer by email.


That article describes the use of mailto link, and OP wants to use mailto
link. Why he wants to do that, that's not my problem.
If the well is inhabited by a dwarf who happens to have an internet
connection, and that by chance your email address is written on the
stone, you might actually receive an email back. Using mailto: as
described in this "article" has approximately the same amount of chances
to work like you expect it.

It cannot be stressed enough: Using mailto with anything else than an
email address doesn't work reliably enough that it's worth even
mentioning it. Just forget it, it doesn't work. What's worse is: When it
doesn't work, you cannot have any feedback from your users, since they
cannot send you any email.

If you don't have any access to CGI (like the excellent, and free,
formmail for example), then use a free service provider, for example
Bravenet.


OK, but OP asked <cite>is there something that can give be a line
break?</cite>.

Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1629
by: levi | last post by:
I'm setting up Zen Cart for the first time and need to run a javascript function when the page loads. e.g., <body onload="myfunc()"> I'm able to get the function included in the <head> section, but have been unsuccessful at modifying the body tag. I know that this has something to do with the mytemplate/jscript/onload/on_load.php file,...
15
29896
by: Val | last post by:
Any experts on mailto: tags? I want to set a link so that the subject and some of the body of the email is filled in. This is easy for simple text, although you need to use %20 for spaces: <a href="mailto:nobody@nowhere.com ?subject=Your web site &body=This%20is%20the%20%body!"> click here</a>
4
7892
by: tp | last post by:
HI... I have created simple .asp page and i would like to send my page as email using my outlook . is it possible to send form body as new email outlook body using mailto command or any other way Pls help me TP
2
7666
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would like mine to run immediately after it. So in the code below, what JS would i need to add to my "myfile.inc" page so that I could guarantee this...
2
1035
by: Luis Esteban Valencia Muñoz | last post by:
I want to add HTML to a page inside the body tag without affecting what .net 1.1 is rendering as normal. Specifically, I want to automatically add a standard header to every page which would be read in from a file. I looked at using the application_beginrequest in the global.asax but think I might be barking up the wrong tree. Is this...
3
1536
by: Michael Hamm | last post by:
My page http://www.math.wustl.edu/~msh210/whatsnew.xml (with XSLT and CSS adding formatting) has a paragraph-type break after "Subscribe to this feed" which, afaIct looking at the source code, shouldn't be there. You can check the entire source, but here's what I think is the relevant part: ----------begin whatsnew.xml <?xml-stylesheet...
5
5647
by: Joh | last post by:
I'm using mailto to open up an email that have a hyperlink in the body. The hyperlink passes two variables Name and Emailadress. The problem is that only the first variable Name show up in the hyperlink. It seems that javascript takes the & as the end of the body where I use it to separate my variables. Anyone know how to deal with this? ...
2
13561
by: Andrew Poulos | last post by:
I'm using the following code to fill an email for the user to send: var t = escape(t); // to var s = escape(s); // subject var b = escape(b); // body var doc = "mailto:" + t + "?subject=" + s +"&body=" + b; window.location = doc; If works fine until the length of 'b' gets over about 255 character,
2
5133
by: GArlington | last post by:
"G. Morgan" <no_em@il.invalidwrote in message news:8787770faf30b1bd48f393baa1a89fdbnp@mypost.invalid... <snap> <snap> Did you try <cr><lf combination? ** Posted from http://www.teranews.com **
0
7601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7913
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7659
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6274
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.