MailTo with HTML body


Answers

No. This is not possible at all.

Question

My problem goes something like this:

A client receives an email sent by Exchange Server. In the mail he has a formatted body with HTML with a couple of links that have

href='mailto:etc...'

My question is: can i insert HTML formatted body in the mailto: part of the href?

something like

<a href='mailto:me@me.com?subject=Me&body=<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.




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

<a href="mailto:YourName@YourSite.com? cc=someone@YourSite.com&bcc=someoneElse@YourSite.com &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='mailto:me@me.com?subject=Me&body=<b>ME</b>'

...you might try:

href='mailto:me@me.com?subject=Me&body=%3cb%3eME%3c%2fb%3e'

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:

<html>
    <head>
        <script type='text/javascript' language='javascript'>
            function OpenOutlookNewEmail()
            {
                try
                {
                    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 = "me@me.com";
                    mailItem.HTMLBody = "<b>ME</b>";
                    mailItem.display(0);
                }
                catch (e)
                {
                    alert(e);
                    // act on any error that you get
                }
            }
        </script>
    </head>
    <body>
        <a href='javascript:OpenOutlookNewEmail()' >email</a>
    </body>
</html>



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

Example:

<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: http://www.uyslist.com/yachts/brochure.pdf"><img src="images/email.png" alt="EMail PDF Brochure" /></a>                        



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 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="mailto:email@address.com?subject=Hello world&body=Line one%0DLine two">Email me</a>





Links