I recently setup a server for a client. The server houses a custom-built PHP application, using MySQL as a back-end (or your basic LAMP website). As usually is the case, the website needs to send out emails, so we use PHP’s internal mail() command (yes, we plan to switch to PHPMailer or another email app – we’re using mail() for now).
After testing, some emails weren’t getting through to the end user. So here are some things we did:
- Made sure the hostname on the server was the same as what the A record points to.
- Added a PTR record with our host.
- Setup a SPF record with the DNS host.
- Turned off the mail server on the server itself.
- Used iptables to block port 25 traffic.
- Setup a physical no-reply email address. We did this b/c some email hosts will block mail if the email originates from a non-existent email address.
Things seem to be working well now.