Configure Amazon SES with Exim

22 / Jan / 2016 by Prashant Sharma 0 comments

I have been working on different MTAs since the last couple of years. This time, the Exim4 use-case which I encountered was to sends emails using premium Email Service Provider.

Use-case: We were supposed to send thousands of emails like auto-reply emails or newsletters from our dedicated server(Ec2 machines) inside the private subnet.

I chose to use Amazon SES, a platform which provides transactional and cost-effective email service using your own email addresses and domains. Click on link to learn more about AWS SES.

Reasons why I chose SES:

  • Reliability
  • Cost
  • Account Security
  • Deliverability
  • Scalability

Exim4 is a general purpose mail package that is highly configurable and flexible. Refer this link to know more about Exim.

Now, Let us configure the Exim4 with following steps:

  • Install the package 

[js]apt-get install exim4[/js]

  • Configure the Exim

[js]sudo dpkg-reconfigure exim4-config[/js]

Mail Server Configuration
1) Mail configuration type as “internet site; mail is sent and received directly using SMTP”
2) Enter the system’s FQDN in the mail name configuration screen.
3) Enter for listen address
4) and rest of the steps, take the default value.
  • Confirm if Exim process has started on port 25 using below command.

[js] sudo netstat -ntpl [/js]


Configuration of the AWS SES with Exim4 includes following steps:

  • Verifying the domain or email address with SES. For more details, follow this link.
  • Create and download the SMTP credentials from AWS SES console. For more details follow this link.
  • Now make the following changes in /etc/exim/exim.conf
1) In the routers section, add below lines:

driver = manualroute
domains = ! +local_domains
transport = ses_smtp
route_list = *[/js]

2) In the transports section, add these following lines:

driver = smtp
port = 587
hosts_require_auth = $host_address
hosts_require_tls = $host_address[/js]

3) In the authenticator section, add these following lines:

driver = plaintext
public_name = LOGIN
client_send = : xxUSER-NAME-xxxx : xxxxxxxPASSWORDxxxxxx[/js]

Note: Use SMTP username and password which were obtained in CSV file, not your AWS access key ID and secret access key.
4) Change existing line “public_name = LOGIN” to following:

[js]public_name = OLD_LOGIN[/js]

  • Restart the Exim service.

[js]sudo service exim4 restart[/js]

  • Now, try sending a mail.

[js]echo AWS-SES-MAIL | mail -r -s TEST[/js]

  • For further debugging, please refer the log file.

[js]tailf /var/log/exim4/mainlog[/js]

That’s all in this blog. If you face any issues don’t forget to share your feedback down below. 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *