mailto link with HTML body

I have a couple of mailto links in a HTML document.

<a href="mailto:etc...">

Can I insert HTML formatted body in the mailto: part of the href?

<a href="<b>ME</b>">Mail me</a>

Note that (2016) in iOS, it is perfectly fine to add <i> and <b> tags for simple italic, bold formatting.


As you can see in RFC 6068, this is not possible at all:

The special <hfname> "body" indicates that the associated <hfvalue> is the body of the message. The "body" field value is intended to contain the content for the first text/plain body part of the message. The "body" pseudo header field is primarily intended for the generation of short text messages for automatic processing (such as "subscribe" messages for mailing lists), not for general MIME bodies.

No. This is not possible at all.

Whilst it is NOT possible to use HTML to format your email body you can add line breaks as has been previously suggested.

If you are able to use javascript then "encodeURIComponent()" might be of use like below...

var formattedBody = "FirstLine \n Second Line \n Third Line";
var mailToLink = "" + encodeURIComponent(formattedBody);
window.location.href = mailToLink;

I have used this and it seems to work with outlook, not using html but you can format the text with line breaks at least when the body is added as output.

<a href=" world&body=Line one%0DLine two">Email me</a>

It's not quite what you want, but it's possible using modern javascript to create an EML file on the client and stream that to the user's file system, which should open a rich email containing HTML in their mail program, such as Outlook:

Here's a jsfiddle of an email containing images and tables:


<!-- -->
<textarea id="textbox" style="width: 300px; height: 600px;">
To: User <user@domain.demo>
Subject: Subject
X-Unsent: 1
Content-Type: text/html

    body, html, table {
        font-family: Calibri, Arial, sans-serif;
    .pastdue { color: crimson; }
    table {
        border: 1px solid silver;
        padding: 6px;
    thead {
        text-align: center;
        font-size: 1.2em;
        color: navy;
        background-color: silver;
        font-weight: bold;
    tbody td {
        text-align: center;
<table width=100%>
        <td><img src="" width="200" height="57" alt=""></td>
        <td align="right"><h1><span class="pastdue">PAST DUE</span> INVOICE</h1></td>
<table width=100%>
        <th>Invoice #</th>
        <th>Days Overdue</th>
        <th>Amount Owed</th>
</textarea> <br>
<button id="create">Create file</button><br><br>
<a download="message.eml" id="downloadlink" style="display: none">Download</a>


(function () {
var textFile = null,
  makeTextFile = function (text) {
    var data = new Blob([text], {type: 'text/plain'});
    if (textFile !== null) {
    textFile = window.URL.createObjectURL(data);
    return textFile;

  var create = document.getElementById('create'),
    textbox = document.getElementById('textbox');
  create.addEventListener('click', function () {
    var link = document.getElementById('downloadlink');
    link.href = makeTextFile(textbox.value); = 'block';
  }, false);

Some things are possible, but not all, say for example you want line breaks, instead of using <br />use %0D%0A


<a href="mailto:?subject=&body=Hello,%0D%0A%0D%0AHere is the link to the PDF Brochure.%0D%0A%0D%0ATo view the brochure please click the following link:"><img src="images/email.png" alt="EMail PDF Brochure" /></a>                        

It is worth pointing out that on Safari on the iPhone, at least, inserting basic HTML tags such as <b>, <i>, and <img> (which ideally you shouldn't use in other circumstances anymore anyway, preferring CSS) into the body parameter in the mailto: does appear to work - they are honored within the email client. I haven't done exhaustive testing to see if this is supported by other mobile or desktop browser/email client combos. It's also dubious whether this is really standards-compliant. Might be useful if you are building for that platform, though.

As other responses have noted, you should also use encodeURIComponent on the entire body before embedding it in the mailto: link.

It is possible to enter unicode values to insert newlines (ie: \u0009) but HTML tags have varying degrees of support and should be avoided.

I have worked this way:

var newLine = escape("\n");
var body = "Hello" + newLine +"World";

Output would be:


Here's how you add everything to a MAILTO link:

<a href=" &subject=Shipping%20Information%20Request&body=Please%20tell%20me%20if%20my%20order%20has%20shipped!">Shipping Request</a>

Each component is separated by the ampersand (&) sign. Only the first component after the initial email address has a question mark (?) preceding the ampersand.

URL-encode is the key! So for your example of a body, instead of your

href='<b>ME</b>' might try:


Here's another route you might try. Create a javascript function to open an ActiveX object. This has the unfortunate limitation of only working in IE and Outlook, and may cause your page to show activex warnings. But if you can live with these caveats, it does the job. Here's a working sample you can draw from:

        <script type='text/javascript' language='javascript'>
            function OpenOutlookNewEmail()
                    var outlookApp = new ActiveXObject("Outlook.Application");
                    var nameSpace = outlookApp.getNameSpace("MAPI");
                    mailFolder = nameSpace.getDefaultFolder(6);
                    mailItem = mailFolder.Items.add('IPM.Note.FormA');
                    mailItem.Subject = "Me";
                    mailItem.To = "";
                    mailItem.HTMLBody = "<b>ME</b>";
                catch (e)
                    // act on any error that you get
        <a href='javascript:OpenOutlookNewEmail()' >email</a>

Need Your Help

Draw rectangles along a circle using html5, css3 and js

javascript html5 css3

I have to draw 32 rectangles along a circle using html5, css3 and js.

Should we use exit() in C?


There is question about using exit in C++. The answer discusses that it is not good idea mainly because of RAII, e.g., if exit is called somewhere in code, destructors of objects will not be called,