Solved

html mailto question - how can I format the email body?

Posted on 2007-04-02
4
14,755 Views
Last Modified: 2008-05-14
I have a mailto: link on my jsp page where I want to automatically populate the email subject and body.

mailto:<user Name>?subject=sub&body=<%= template %>

The mailto DOES open my email client and populate the subject and body.
However, the text in the body is not formatted.

Even though I use "\n" in my text, the line breaks do not happen.
Please let me know how I can do text formatting. Also is it possible to do bold or underline?
thank you.
0
Comment
Question by:mytilig
4 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18839083
>> Even though I use "\n" in my text, the line breaks do not happen.

What is displayed instead of the new line?

Maybe try specifying the text as HTML:

<HTML>.... mail contents ....</HTML>

Try using <BR> for line breaks, <BOLD> etc for bold fonts. But I am not sure if this will work.
0
 

Author Comment

by:mytilig
ID: 18839216
It is simply ignoring the \n characters. all the text appear together.
html tags like <br> does not work.
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 250 total points
ID: 18840229
Within the body use "%0A" for a new line,
use "%0A%0A" for a new line preceded by a blank line (paragraph),
see example below.
<a href="mailto:astark1@unl.edu?&body=The message's first paragraph.%0A%0aSecond paragraph.%0A%0AThird Paragraph.">
0
 
LVL 9

Assisted Solution

by:fuzzboxer
fuzzboxer earned 250 total points
ID: 18840242
You need to use URL Encoding.  For instance, if you wanted spaces you would have to use %20 in between you items.

Use this tool to get the results you want:  http://www.w3schools.com/tags/ref_urlencode.asp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now