banner

Blogs

How To Configure Amazon SES With Postfix Mail Server

  • January 13th, 2016
  • By Praveen
  • Blog
  • amazon SES

    Amazon SES (Simple Email Service)

    Amazon SES (Simple Email Service) is a low-cost mail service used for mass mailing built on the reliable and scalable infrastructure that developed to serve its own customers. It can be used for sending transactional email, marketing messages etc.., by relaying through aws ses service.

    Amazon SES is a free service for aws customers and its billing is based on the usage of the service, As for the normal package, it provides with 50000 emails in a month with a max send rate of 14 emails/second.

    Amazon SES service is available from the console and also from the command line interface.

    Steps To Configure With Postfix

    Before the configuring of postfix with SES check for the prerequisites, and verify them,

    • Confirmed postfix is installed and is able to send email from server
    • Create a user for SES access and keep credentials safe
    • Attach a policy to the user created (Administrative access to SES)

    Firstly we have to create a user in aws IAM for SES access, with secret key and access key.

    Attach a policy for the user to have administrative access to SES like image below,

    Assuming SES at US East N.Virginia region

    • Navigate to main.cf file in /etc/postfix
    • Add the below lines to main.cf file (Preferably bottom)
    • Navigate to main.cf file in /etc/postfix
    • Add the below lines to main.cf file (Preferably bottom
    • Save and close the file.
    • Navigate to master.cf file in /etc/postfix
    • Check all configuration lines are present in the postfix .conf file
    • Comment out the line -o smtp_fallback_relay= as shown;
    • Create or edit /etc/postfix/sasl_passwd file by replacing username and password by the generated SMTP credentials as shown (Not the secret/access key of user)
    • Replace the username/password and save the /etc/postfix/sasl_passwd.db file.
    • To create a hashmap database file containing ses smtp credentials use the command as below:
      postmap hash:/etc/postfix/sasl_passwd
    • Restrict access to the above file as it contains the smtp credentials
    • Stop and restart the postfix service.
    • If you want to add a domain name to relay through aws ses you should verify the domain name as shown below,
    • To verify the domain find the screen-shot below:
    • After the domain is verified you can try sending a mail from server as:
      • mail -s “Subject” mail address
      • Or Sendmail –f from address and to address following subject and press cntrl+D
    • Please check the inbox and you could see the mail as:
      • Mailed-by:us-east-1.amazonses.com
      • Signed by: verified domain.com

    Recent Post