Sending Emails with Postfix and Amazon SES

As an alternative of installing a complete email server, you can send emails from your Amazon EC2 instance using postfix and Amazon SES service like this :

  • Create an AWS IAM SES user and attach AmazonSesSendingAccess policy to this user
  • Install needed packages (in my case Debian jessie instance) :

  • Edit /etc/postfix/main.cf file like this :

Change the relayhost if needed (depending on your zone)

  • Then create /etc/postfix/sasl-passwords with this contents :

Change the aws smtp server if needed (depending on your zone)

  • Run the follwing command :

  • Restart postfix service :

Before sending you need to verify the email address that you will use to send emails in the SES section Email Addresses, and if you want to be able to send emails to addresses that are not verified in your AWS account contact AWS support and ask them to let you leave the sandbox mode to production mode.

  • Test all this with sendmail :

  • Giorgio Scavuzzo

    Thank you! This one works, while the one provided by Amazon does not!

    • Ian

      Can you please link me to the document that wasn’t working so that I can try and get it fixed for you?