Configuring Postfix to use with AWS SES

I use AWS SES to send email to internet from home network.
So, here is brief configuration note.

# AWS SES SMTP endpoint
relayhost = [email-smtp.ap-northeast-2.amazonaws.com]:587

# enable SASL authentication
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

# enable TLS
smtp_use_tls = yes

create /etc/postfix/sasl_passwd

[email-smtp.ap-northeast-2.amazonaws.com]:587 username:secret_password

Username and password can be created on AWS Console.

sudo postmap /etc/postfix/sasl_passwd
sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
echo "SES Relay Test" | mail -s "Test Subject" -r root@testhost.dgkim.net dgkim@dgkim.net
# /etc/postfix/main.cf
myorigin = /etc/mailname
# /etc/mailname should contain official FQDN
  • /etc/postfix/generic
# local     aws ses email
@myhosname  systemmail@example.com
  • postmap
sudo postmap /etc/postfix/generic
  • /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic