Skip to content

How to make Insert HTML code in mailto body?

  • by

Is it possible to Insert HTML code in mailto body?

Answer: Document Section 2 of RFC 2368 says that the body the field is supposed to be in text/plain format, so you can’t insert/add HTML code.

However, even if you use plain text it’s possible that some modern mail clients would render a URL as a clickable link anyway, though.

mailto body HTML table

Here is example code but it seems like the table is inserted as plain text.

<!DOCTYPE html>
<html>
<body>

    <a href="mailto:[email protected]?subject=tester&body=<table><tr><td>test</td><td>test</td></tr></table>">Email with table</a>
    

</body>
</html>

Output:

Insert HTML code in mailto body table

How to pass the HTML formatted body in mailto?

Use %0D%0A for a line break in your body. Here is a example code:-

<!DOCTYPE html>
<html>
<body>

    <a href="mailto:[email protected]?subject=Suggestions&body=name:%0D%0Aemail:">
    Send Email</a>​


</body>
</html>

Output:

pass the HTML formatted body in mailto

Do comment if you have any doubts and suggestions on this topic.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *