Zend_Mail发送的电子邮件被视为垃圾邮件 [英] Zend_Mail sent email is treated as SPAM
本文介绍了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发送的电子邮件被视为垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文