Question

Is there any way to include an HTML template for the mailto() function body? E.g. I have the next link:

echo "<a href="mailto:email@gmail.com?subject=subject&body=the%20body>Send email</a>";

and I want to do something like this:

$template = "<h1>Some text</h1><p>More text<p><img src='imageurl' />";

echo "<a href="mailto:email@gmail.com?subject=subject&body=" . $template . ">Send email</a>";

Of course, the above code is putting the raw HTML into the body. So, how to give format to it? I've found a similar question here, but this is an old one, and the accepted answer doesn't let to give HTML format to the content.

Note: I know that it's not the best way to send mails, but it is just an option to let the user to change the content of the default body, and send it with its own mail account.

No correct solution

OTHER TIPS

What you want is not possible, you cannot put html tags into mailto body.
Answer from subject : MailTo with HTML body :

The special hname "body" indicates that the associated hvalue is the body of the message. The "body" hname should contain the content for the first text/plain body part of the message. The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies.

mailto:destination@gmail.com?body=this is the body
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top