Use a body template for mailto [duplicate]
Asked Answered
C

2

7

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 protected]?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 protected]?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.

Chinua answered 17/2, 2014 at 13:26 Comment(0)
E
3

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.

Embowed answered 20/4, 2015 at 12:14 Comment(0)
O
2
mailto:[email protected]?body=this is the body
Overlarge answered 17/2, 2014 at 13:33 Comment(2)
You're not giving HTML format to the body.Chinua
You can't do it, sorryOverlarge

© 2022 - 2024 — McMap. All rights reserved.