7
希望得到一些代碼的一些幫助,我使用WordPress的主題,它將郵件標題設置爲文本/ HTML,這會導致一些純文本郵件ex問題。 linebreaks不再顯示。wordpress郵件頭設置其他純文本
我試過設置:
} else {
return 'text/plain';
}
,但我不知道PHP的非常好,所以我不知道在哪裏放置它,使其工作。我想爲未定義的郵件設置文本/純文本。
這是爲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'] = html_entity_decode($compact['message'], ENT_QUOTES, 'UTF-8');
$compact['subject'] = html_entity_decode($compact['subject'], ENT_QUOTES, 'UTF-8');
//$compact['message'] = et_get_mail_header().$compact['message'].et_get_mail_footer();
return $compact;
}
嗨手帕웃Panky,你的回答讓這麼多的感覺,我覺得我幾乎沒有。基於我上面發佈的代碼,是否有可能知道var應該是什麼?我將在哪裏放置您發佈的代碼行? – Elcangri
是你的變量是'$ compact [「message」] = nl2br($ compact [「message」]);'並且它正好在函數的最後一行之上。即回電以上。查看編輯 –
我試過了什麼建議,它適用於純文本電子郵件,他們現在有一個正確的換行符,但現在HTML電子郵件顯示爲空白。我查看了源代碼,發現每行都得到了
標記'code <!DOCTYPE html PUBLIC「 - // W3C // DTD XHTML 1.0 Strict // EN」「w3.org/TR/xhtml1/DTD/xhtml1 -strict.dtd 「>
<風格類型= 「文本/ CSS」>
' – Elcangri