View Full Version : preformatted mailto: email message within javascript

01-13-2005, 02:51 AM
In one of my web pages, I'm trying to preformat a "mailto:" URL email message (within javascript). When I have my browser (IE 6) email tool set to Outlook Express, the formatting works. When I have my browser email tool set to Yahoo Mail, the formatting is lost. Is ther a way I can get the formatting to work in Yahoo mail, and across all other mail tools?

I've tried using different character sets (hex, octal, and excape sequences {like \n}, but they all get stripped out. Here is a similar javascript function that I'm using:

function go(){
window.location='user@domain.com?subject=Subject text&body=Body text line 1.%0ALine 2.\n';


01-13-2005, 03:51 AM

function go(){
window.location='user@domain.com?subject=' + escape("Subject text") + '&body=' + escape("Body text line 1.\nLine 2.\n");

Or simply use this tool (http://www.webreference.com/js/column70/3.html) which does the same thing.

01-14-2005, 06:55 PM
Thx for the suggestion, but I had already tried escape(). It makes no difference with Yahoo mail. And escape() essentially converts \n to %0A. Yahoo strips that out.