Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mailto link with HTML body

Tags:

html

email

mailto

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="mailto:[email protected]?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.

like image 937
GxG Avatar asked Apr 11 '11 10:04

GxG


People also ask

How do I add HTML to the body mailto?

The Mailto format does not support HTML code emails. Outlook was used at 2003, but to become compliant with the mailto: standard they removed that functionality. But you can Use %0D%0A for a line break in HTML body.

How do you send an HTML email via mailto?

HTML Email Tag HTML <a> tag provides you option to specify an email address to send an email. While using <a> tag as an email tag, you will use mailto: email address along with href attribute. Following is the syntax of using mailto instead of using http.

How do you put a link in the body of an email?

In the message, select the text or picture that you want to display as the link. On the Insert tab, click Link or Hyperlink. Under Link to, click E-mail Address. Either type the email address that you want in the E-mail address box, or select an email address in the Recently used e-mail addresses list.


2 Answers

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.

like image 128
Alfonso Marin Avatar answered Sep 28 '22 03:09

Alfonso Marin


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 = "mailto:[email protected]?body=" + encodeURIComponent(formattedBody); window.location.href = mailToLink; 
like image 40
Oliver Pearmain Avatar answered Sep 28 '22 05:09

Oliver Pearmain