AWS EC2 Postfix Email Configuration Tips

Although the Postfix sendmail function will work out-of-the-box on an aMiSTACX deployment, here are some tips in case you run into issues.

    1. Set the main.cnf to IP4 for the interface protocol
      sudo nano /etc/postfix/
      inet_protocols = ipv4
    2. Make sure your hostname is the name of your domain. e.g.,
      sudo nano /etc/hostname
    3. Set the mydomain parameter to your hostname e.g. ~ Line 35: myhostname =
    4. Remove AWS DNS name from ~ Line 39: mydestination = $myhostname, ip-172-30-0-139.ec2.internal, localhost.ec2.internal, , localhost
    5. Restart Postfix after any changes:
      sudo service postfix restart
    6. Make sure external DNS is configured correctly with any PNTR or SPF records
    7. Make sure outbound TCP Port 25 is open. [Sendmail’s Default and SMTP’s Default]
    8. Make sure no AWS restrictions on EMAIL.
    9. Quick test from CLI:
      echo "Subject: sendmail test" | sendmail -v


Log files go to /var/log/mail.log and /var/mail/

If you don’t see verbose logs, set the /ect/mailname to your FQDN for the server. e.g.,

Then restart the postfix service

sudo service postfix restart

Tip: Clear the Postfix message queue: sudo postsuper -d ALL


Do you really need to send email on SMTP 25? Perhaps SMTPS [Secure] on 587 or 465 is a better alternative? For a CMS like Magento or WordPress there are many alternatives that are available for free, and come as a plugin and offer better end-to-end security.

~ Lead_Robot