Solved

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

Posted on 2007-04-02
4
14,902 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

816 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

13 Experts available now in Live!

Get 1:1 Help Now