本文介紹了Zend_Mail 發送的電子郵件被視為垃圾郵件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
請告訴我我做錯了什么.我正在使用 Zend_Mail 類發送電子郵件,如下所示:
Please tell me what I am doing wrong. I am sending an email using the Zend_Mail class like this:
$message = <<<STR
You have a new invoice!
Sign in to your clientarea to see it.
Best regards,
Company name
STR;
$mail = new Zend_Mail();
$mail->setBodyText($message);
$mail->setFrom('billing@company.com', 'Company.com');
$mail->addTo('client@email.com', 'Client Name');
$mail->setSubject('You have a new invoice!');
$mail->send();
雖然它是作為垃圾郵件接收的.我的服務器上還有其他應用程序,例如 Webmin,它們發送的電子郵件不會被視為垃圾郵件.
It is received as a spam though. There are other applications such as Webmin on my server and emails they send is not treated as SPAM.
推薦答案
我通過添加這些行解決了這個問題:
I have solved this by adding these lines:
$mail->setReplyTo('contact@company.com', 'Company');
$mail->addHeader('MIME-Version', '1.0');
$mail->addHeader('Content-Transfer-Encoding', '8bit');
$mail->addHeader('X-Mailer:', 'PHP/'.phpversion());
關鍵行似乎添加了 Reply-To 標題.沒有它,它總是會進入垃圾郵件.一旦我設置了 Reply-To 標頭,電子郵件客戶端就停止將其視為垃圾郵件.
The critical line seems to be adding Reply-To header. Without that it would always go to SPAM. Once I set the Reply-To header email clients stopped treating it as spam.
這篇關于Zend_Mail 發送的電子郵件被視為垃圾郵件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!