而不是:
Hello,
Thank you dfasdfasdfasdf asdf asdf asdfas dfs
Please, feelasdf asdf asdf
到达我邮箱的电子邮件如下所示:
<p>Hello,</p>
<p> </p>
<p>Thank you dfasdfasdfasdf asdf asdf asdfas dfs</p>
<p> </p>
<p>Please, feel asdfads fad f</p>
所以,我猜HTML没有为
wp_mail()
作用您如何打开它,以便邮件能够如期送达,以及
<p>
和
<br>
标签是否正确解释?
我正在使用此邮件从functions.php
按下提交按钮时:
$headers = \'From: XXXXXX.com <[email protected]>\' . "\\r\\n";
$subject = \'Registration from xxxxx.com\' . "\\r\\n";
$message = $result_email_text;
wp_mail($_POST[\'admin_email\'], $subject, $message, $headers );
SO网友:dipali
默认内容类型为\'text/plain\'
这不允许使用HTML。您可以通过包含“内容类型:文本/html”这样的标题来设置电子邮件的内容类型
$headers = \'Content-type: text/html;charset=utf-8\' . "\\r\\n";
$headers .= \'From: XXXXXX.com <[email protected]>\' . "\\r\\n";
$subject = \'Registration from xxxxx.com\' . "\\r\\n";
$message = $result_email_text;
wp_mail($_POST[\'admin_email\'], $subject, $message, $headers );
也可以使用
wp_mail_content_type
滤器
remove_filter( \'wp_mail_content_type\', \'set_html_content_type\' );
add_filter( \'wp_mail_content_type\', \'set_html_content_type\' );
function set_html_content_type() {
return \'text/html\';
}
有关更多详细信息,请参阅以下链接:
http://codex.wordpress.org/Function_Reference/wp_mail