希望得到一些代码的帮助,我使用wordpress的主题,将邮件头设置为text/html,这导致纯文本邮件ex的一些问题.换行符不再显示.
我尝试过设置:
} else {
return 'text/plain';
}
Run Code Online (Sandbox Code Playgroud)
但我不太清楚PHP,所以我不知道在哪里放置它才能使它工作.我想为未定义的邮件设置text/plain.
这是wp头的代码:
/**
* filter mail headers
*/
function wp_mail($compact) {
if (isset($_GET['action']) && $_GET['action'] == 'lostpassword') return $compact;
if ($compact['headers'] == '') {
//$compact['headers'] = 'MIME-Version: 1.0' . "\r\n";
$compact['headers'] = 'Content-type: text/html; charset=utf-8' . "\r\n";
$compact['headers'].= "From: " . get_option('blogname') . " < " . get_option('admin_email') . "> \r\n";
}
$compact['message'] = str_ireplace('[site_url]', home_url() , $compact['message']);
$compact['message'] = str_ireplace('[blogname]', get_bloginfo('name') , $compact['message']);
$compact['message'] = str_ireplace('[admin_email]', get_option('admin_email') , $compact['message']);
$compact['message'] = …Run Code Online (Sandbox Code Playgroud)