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 发送的电子邮件被视为垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Zend_Mail 发送的电子邮件被视为垃圾邮件


- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01