How to send emails with Postfix and Amazon AWS SES on RHEL/CentOS 8
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:
- Install the Postfix package by running the following command:
sudo dnf install postfix- Create an IAM user and access key in the AWS Management Console with permissions to use SES.
- Create a new rule set in the SES console that allows the IP address of your Postfix server to send email through SES.
- 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 = yesrnsmtp_sasl_security_options = noanonymousrnsmtp_sasl_password_maps = static:YOUR_IAM_USER:YOUR_IAM_SECRETrnsmtp_use_tls = yesrnsmtp_tls_security_level = encryptWhere 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.
- 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- Test the Postfix email sending by using the following command:
echo "Test message" | mail -s "Test Subject" recipient@example.com- Check the Postfix mail log /var/log/maillog for any errors or issues.
