Php Mail() - Making It Not Suck Using Sendmail
Ok ok … as some of the people work with are aware, I did this months ago fro one project, ment to blog and document it then in fact I have a draft post last modified 06/05/2011 covering full spam score reduction, and half finished instructions on setting up a mail relay … so in the interim of finishing that post I’m going to cover improving user experience through proper php configuration.
Out of the box, php will use sendmail, and it will do so as follows.
- mail() forks sendmail process
- sendmail attempts to send email to destination server
- sendmail returns on send complete
sendmail_path = /usr/sbin/sendmail -t -i -O DeliveryMode=b
This sets the delivery mode to background, sendmail will return to php near instantly and send the email in the background by placing in into a queue.
TL;DR
Put the above in your php.ini to not hang around to sendmail, and hav it return instantly.