使用 Symfony Mailer 对象发送的电子邮件会进入垃圾邮件文件夹
我使用 Symfony 1.4.8 和 Propel 作为 ORL。我正在使用 Symfony miler 对象发送邮件,邮件发送正确,但它进入垃圾邮件文件夹,有什么方法可以阻止这种情况。我正在使用的代码,
$to_email_array=array("[email protected]","[email protected]");
$body="welcome to symfony";
$subject="from Symfony";
$from=array('[email protected]' => 'our Domain');
$mail_object=$this->getMailer();
$message=Swift_Message::newInstance()
->setSubject($subject)
->setBody("<html> <head> </head> <body> <span>Dear {receiver}, </span>".$body."</body> </html>", "text/html")
->setFrom($from)
->setTo($to_email_array);
$mailed=$mail_object->batchSend($message);
上面的代码是从 Symfony 任务调用的,我们正在使用我们自己的 Web 服务器使用我们的域名发送邮件。邮件已发送,但进入垃圾邮件文件夹。有什么办法可以阻止邮件进入垃圾邮件文件夹。
I am using Symfony 1.4.8 and Propel as ORL. I am sending mails using Symfony miler object, the mail is send properly but it goes to spam folder, is there any way to stop that. the code that i am using,
$to_email_array=array("[email protected]","[email protected]");
$body="welcome to symfony";
$subject="from Symfony";
$from=array('[email protected]' => 'our Domain');
$mail_object=$this->getMailer();
$message=Swift_Message::newInstance()
->setSubject($subject)
->setBody("<html> <head> </head> <body> <span>Dear {receiver}, </span>".$body."</body> </html>", "text/html")
->setFrom($from)
->setTo($to_email_array);
$mailed=$mail_object->batchSend($message);
The above code is called from a Symfony Task, and we are using our own web server to send mail, with our domain name. The mail is send, but it goes to spam folder. Is there any way to stop the mail going to spam folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
垃圾邮件过滤可以基于基础设施问题,也可以基于消息内容。您需要告诉我们有关您的设置的更多信息,或者尝试一些操作来找出问题所在:
您的网络服务器是否有唯一的 IP,并且您的网络服务器是否设置了反向 DNS IP?
您在 DNS 中是否有 SPF 记录,指定您的网络服务器有权为您的域发送电子邮件?如果您不确定我的意思,您可以阅读以下内容: http://www.open- spf.org/Tools/
哪些电子邮件服务或客户端正在垃圾邮件/退回电子邮件?是否添加了消息标头来指示匹配了哪些过滤规则?
Spam filtering can be either based on infrastructure problems, or on message content. You will need to tell us more about your setup, or try a few things, to work out where the problem is:
Do you have a unique IP for your web server, and you have reverse DNS set up for your web server IP?
Do you have a SPF record in DNS designating your web server as authorized to send email for your domain? If you're not sure what I mean, you can read this: http://www.open-spf.org/Tools/
Which email service(s) or client(s) are junking/bouncing the emails? Are there any added message headers indicating what filter rules were matched?
您需要设置DKIM和SPF,这可以轻松完成观看此视频。这些将允许其他网站验证电子邮件是否确实来自您并且可以信任。
You need to setup DKIM and SPF which can be done easily by watching this video. Those will allow other sites to verify emails actually came from you and can be trusted.
我通常发现对我有用的是以 RFC822 格式指定所有地址(收件人、发件人、抄送等),如下所示:
What I generally find to work for me is to specify all addresseses (To, From, Cc, etc) in RFC822 format, like so: