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:
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:
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