I'm in the middle of a never-ending migration of a 16-year-old site to CodeIgniter 4 (which has numerous nontrivial problems). I see that in the past, the server was configured such that Postfix would route all mail off the machine and try to deliver it via Amazon SES. That being the case, the PHP mail()
function works and mail is routed via Postfix to the SES gateway. If I'm not mistaken, this approach has the nice feature that PHP will return almost instantly from a mail()
function call when Postfix accepts the mail almost instantly. Postfix has its own log which can be quite useful for troubleshooting problems.
However, CI4 supports SMTP mail delivery and Amazon SES offers an SMTP gateway. This seems a lot less complicated than configuring postfix. On the other hand, all those emails generated by the system (e.g. samhain or cron job errors) would not benefit from PHP using SMTP.
I'm curious what approach others might be using for their servers? Do you have a preferred email service (e.g., MailChimp, SendGrid, AmazonSES)? Do you have a preferred MTA (e.g., Postfix, Sendmail, Qmail)? What's your interface between PHP and your mail system (e.g., mail function, SMTP client, etc)?