Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use a body template for mailto [duplicate]

Tags:

html

mailto

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.

like image 624
Manolo Avatar asked Feb 17 '14 13:02

Manolo


People also ask

How do I pass HTML formatted body in mailto?

It is not possible to pass the HTML in email body while using mailto link. It takes only string/text value. It says, for line breaks, instead of using <br /> use %0D%0A .

How do I add a body text to a mailto link?

subject=<subject> to the mailto tag. For example, the complete tag would look similar to the example below. You can also add body text by adding &body=body to the end of the tag, as shown in the example below. You can also include &cc= or &bcc= to fill out the CC and BCC fields.

How do I mailto multiple email addresses?

For example, mailto:[email protected] . You can also: Specify multiple recipients in the To field, separating addresses with a comma (,) or a semicolon (;). For example: mailto:[email protected],[email protected].

Can you add a subject to a mailto link?

Insert the email field into your signature template. Select the email field and click Add Hyperlink option. If the desired hyperlink if already present in the template, you can simply edit it.


2 Answers

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.

like image 190
user4810300 Avatar answered Sep 29 '22 03:09

user4810300


mailto:[email protected]?body=this is the body
like image 33
fabio_vac Avatar answered Sep 29 '22 02:09

fabio_vac