New Ubuntu admin here, trying to enable the PHP mail() function on my server. I have it working, but am wondering if my setup is secure...
My [full] mail solution is as follows:
1) For incoming mail to @mydomain.com, I use email forwarding through my domain host // for outgoing mail, I use an alias on top of a gmail account that appears as if it sends from @mydomain.com
2) For mail generated by my webserver (www-data), which will pretty much just be used to send password resets, it appears to be successfully handled by postfix. The postfix setup is essentially the following, plus a few smtp_tls rules I added in to achieve TLS on outbound emails when possible.
myorigin = $mydomain
mydestination =
mynetworks = 127.0.0.0/8
inet_interfaces = loopback-only
I made some assumptions while doing this config, namely:
- loopback-only config means NOBODY other than my localhost can send mail through postfix
- I do not need to specify a relay_host here
- Since this is outbound only, all smtpd_* config settings are unnecessary
- Since all requests to send through postfix SMTP is through a PHP script that controls for user input (avoiding injection), this is an inherently secure setup.
Is there anything I'm missing? Any ways to make this setup more secure? I think postfix is overkill for an outbound-only server, but I recently did a ton of reading on postfix configs. Is sendmail a reasonable / simpler alternative? Is there a better package (e.g. nullmailer) to use?
Thanks!