Skip to content
TrySitePrice

How to send emails with Postfix and Amazon AWS SES on RHEL/CentOS 8

Best/Tutorial

Postfix is a popular open-source mail transfer agent (MTA) that can be used to send emails on Red Hat Enterprise Linux (RHEL) and CentOS 8 using Amazon Web Services (AWS) Simple Email Service (SES). To set up Postfix to send emails with Amazon SES on RHEL/CentOS 8, you can follow these steps:

  1. Install the Postfix package by running the following command:

sudo dnf install postfix

  1. Create an IAM user and access key in the AWS Management Console with permissions to use SES.
  2. Create a new rule set in the SES console that allows the IP address of your Postfix server to send email through SES.
  3. Configure Postfix to use SES as a relay host by editing the file /etc/postfix/main.cf, add the following lines:

relayhost = :587

smtp_sasl_auth_enable = yes

smtp_sasl_security_options = noanonymous

smtp_sasl_password_maps = static:YOUR_IAM_USER:YOUR_IAM_SECRET

smtp_use_tls = yes

smtp_tls_security_level = encrypt

Where is the SES SMTP endpoint for your region, and YOUR_IAM_USER and YOUR_IAM_SECRET are the IAM user and access key you created in step 2.

  1. Start the Postfix service and enable it to start automatically at boot time using the following command:

sudo systemctl start postfix

sudo systemctl enable postfix

  1. Test the Postfix email sending by using the following command:

echo "Test message" | mail -s "Test Subject" recipient@example.com

  1. Check the Postfix mail log /var/log/maillog for any errors or issues.

It is important to note that Amazon SES has strict sending limits and usage fees, and it is important to monitor your usage to avoid exceeding these limits and incurring unexpected charges.