Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best practice to send emails from PHP script?

I hope this question wont be too specific. But I really need to ask. We all know that we cannot fully prevent our emails to go to spam box right? But I guess we can decrease the #of emails that goes there.

Till now, I use PHP's built-in function mail() but I guess there are other methods right? What are they and what is your best practice for this prblem?

Also is there a way to sending emails through Google Appspot? Thanks!

like image 990
makyol Avatar asked May 13 '11 16:05

makyol


2 Answers

A hosted service may be a better way to go. They've developed procedures, and relationships with ISPs, that will help get your e-mails delivered and will help you fend off spam complaints.

I have a mailing list for a blog that I run, and I decided not to send out an e-mail that had an (otherwise legitimate) story that dealt with a pharmacy. I figured almost nobody would get the e-mail, and that I'd get a lot of spam complaints, just because of the word "pharmacy."

Provide useful information in your e-mails first and foremost. Use double opt-in procedures. That will reduce the probability of your e-mail being sent to spam.

like image 76
John Avatar answered Nov 10 '22 01:11

John


I am using Swiftmailer.

  • easy to integrate
  • easy to use
  • has a cool documentation

If you read the docs and follow guidelines, you will have much less mails landing in the spam folder. I have used it with great success. It also has some useful plugins.

like image 42
kapa Avatar answered Nov 10 '22 01:11

kapa