Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

747 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

12 Experts available now in Live!

Get 1:1 Help Now