开发者

emails send using Symfony Mailer object goes to Spam folder

开发者 https://www.devze.com 2023-02-10 21:10 出处:网络
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

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("one@gmail.com","two@gmail.com");
$body="welcome to symfony";
$subject="from Symfony";
$from=array('me@mydomain.com' => '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.


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:

  1. Do you have a unique IP for your web server, and you have reverse DNS set up for your web server IP?

  2. 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/

  3. Which email service(s) or client(s) are junking/bouncing the emails? Are there any added message headers indicating what filter rules were matched?


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.


What I generally find to work for me is to specify all addresseses (To, From, Cc, etc) in RFC822 format, like so:

To: "John Doe" <ddd@Org.tld>

0

精彩评论

暂无评论...
验证码 换一张
取 消