html – 使用正文模板进行mailto [复制]

参见英文答案 >
mailto link with HTML body                                    10个

有没有办法为mailto()函数体包含HTML模板?例如.我有下一个链接:

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

我想做这样的事情:

$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>";

当然,上面的代码将原始HTML放入正文中.那么,如何给它格式呢?
我发现了一个类似的问题here,但这是一个旧问题,并且接受的答案不允许给内容提供HTML格式.

注意:我知道这不是发送邮件的最佳方式,但它只是让用户更改默认正文的内容并使用自己的邮件帐户发送的选项.

最佳答案 您想要的是不可能的,您不能将html标签放入mailto正文.

主题答案:
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.

点赞