Problem scenario
You quickly set up an email server on a virtual machine in a public cloud. Some emails from the server are being received but some are not being received. What could be wrong?
Solution
1. If you are using Postfix, check the files in these locations:
/var/spool/postfix/private/bounce
/var/spool/postfix/bounce
/usr/lib/postfix/bounce
2. Look at the file /var/log/mail for clues about what could be wrong. If it is being written to (that is, if there is mail activity), you may want to make a copy of the file and delete that copy when you are done. When examining the file with vi, use this command::set ignorecase
Then you can use the forward slash "/" to search for patterns (e.g., "return", "fail", or "undeliverable"). In our experience the word "rejected" is a good one to search for.
3. Check the hostname of the server to see if it has numbers. The email server's hostname can be alphanumeric. Is an IP address visible (e.g., AWS servers look like this: 172-3-56-91.us-west-2.compute.amazonaws.com) in the hostname? Some spam filters will identify this hostname as a "likely spam" problem. There is a points algorithm that some anti-spam filters use which can lead to non-delivery of email. This can be solved as easily as changing the hostname of the server. Modify the /etc/hostname file to have the new hostname you want. Update the /etc/hosts file and mail.cf files to reflect this new hostname (without four octets being divided by dashes). Reboot the server and then send an email.
Please do not use this to spam people. Send email responsibly!
Another Possible Solution
Another way to do this is with Python; to learn how to use Python and not install anything else, see this external posting.