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: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.
As you can see in RFC 6068, this is not possible at all:
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:
https://stackoverflow.com/a/27971771/8595398
Here's a jsfiddle of an email containing images and tables: https://jsfiddle.net/seanodotcom/yd1n8Lfh/
HTML
Javascript
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 themailto:
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.I have worked this way:
Output would be: