我已经看到了this 答复它帮助我制作了独特的邮件。太棒了。但是如何使用HTML格式化一些文本呢?例如,使用标记
<b> <i> <font color="red"> <img src="">
我写道
spintf("<a href="http://site.com/some-page">Text</a>");
在我的邮件中,我收到了
<a href="http://site.com/some-page">Text</a>
而不是这个
Text.WordPress mailer似乎剪切了HTML,因为我尝试了printf和echo。或者我只是做错了什么?
最合适的回答,由SO网友:Vitaliy Kukin 整理而成
wp_mail from Codex
使用以下示例:
add_filter( \'wp_mail_content_type\', \'set_html_content_type\' );
wp_mail( $mails_to, \'The subject\', \'<p>The <em>HTML</em> message</p>\' );
// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
remove_filter( \'wp_mail_content_type\', \'set_html_content_type\' );
function set_html_content_type() {
return \'text/html\';
}