How to Add an HTML Link in the Body of a Mailto Link

Is it possible to add an HTML link in the body of a MAILTO link

Section 2 of RFC 2368 says that the body field is supposed to be in text/plain format, so you can't do HTML.

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 link with HTML body

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.

Inserting Link inside Mailto body

You can't have spaces in URLs so you must encode the space in the filename in order to create a URL to the file.

mailto: URLs are URLs so an encoded space will be converted back to a regular space when it is parsed. When inserting one URL into an other, you must encode all the special characters in the nested URL (i.e. you need to convert the % characters to %25).

mailto link using computed property not loading full message body

You must URL-encode your data before assigning it to the HREF property of a hyperlink/anchor tag:

mailToString()
{
return "mailto:" + encodeURIComponent(this.formData.emailList) + "?subject=" + encodeURIComponent(this.formData.subject) + "&body=" + encodeURIComponent(this.emailContent);
},

Otherwise it might interfer with some reserved characters, e.g. ? or = or & or some Unicode character.



Related Topics



Leave a reply



Submit