AWS, Cloud Computing, DevOps

4 Mins Read

Postfix Email Server integration with SES

Have you ever  thought of setting up a web or application server with your own mail server? Have you ever tried to do so and stuck at some point? Well, when you host a website or your application it is likely to have your own mail server to handle incoming and outgoing mail to your domain. Before I get into my topic, I assume that you have got basic knowledge on AWS. For any kind of cloud training please visit www.cloudthat.com. Here, I’m going to explain you how to setup a simple postfix email server with AWS SES to handle all your email needs of the application. AWS SES (Simple Email service) is a cost effective email service built on AWS cloud. You will be launching an Amazon EC2 machine to setup your email server. Let me put it in this way. We have got two phases in this implementation.

  1. Configure SES with your Domain
  2. Integrate postfix with SES on an EC2 machine

Configure SES with your Domain

Domain name is essentially the name given to your website, which helps the visitors to remember the site. For example, we have got a domain cloudthat.com and we have the websites like blog.cloudthat.com, training.cloudthat.com with different purpose. Lets come to the Email part. Email address will be always with a domain name. In order to send a mail through SES we have to verify our domain name so that we can use any Email ID with this domain name as from address. Let’s verify our domain name with SES.

1

11

12

13

14

15

Note: This will create an IAM user for you with needed SES privileges.

Integrate postfix with SES on an EC2 machine

In this phase you are going to launch an EC2 machine. Then you will install postfix as your mail transfer agent (MTA) and configure your postfix to talk to SES which we configured now. Let’s go step by step to configure the mail server.

Now let’s login to our machine using putty or any SSH client. First, make sure to set the hostname.

We will install postfix as our MTA to send and receive mail.

We need to make minimum changes in postfix configuration to enable our mailing service. Let’s do it one by one.

To integrate our postfix to SES we need to add few more lines to main.cf file.

Note:Relay host will change depend upon the SES region you use. To get the SES end point visit Regions and Endpoints.

Comment out the following line of the master.cf file by putting a # in front of it:

Edit the /etc/postfix/sasl_passwd  File. Create the file if it does not exist

Note: Add your SMTP username and password which you downloaded. Save and close the file use the following command to create a hashmap database file containing your SMTP credentials.

Now we have to tell postfix where to find CA certificates. This is very much needed to verify the Amazon SES server certificates.

Stop and start postfix

We are ready with your mail server. Lets send a test email.

Note: you must replace from@example.com with your “From” email address, which you must have previously verified with Amazon SES. Replace to@example.com with your “To” address. If your account is still in the sandbox, the “To” address must also be verified.

Pricing

WRITTEN BY CloudThat

SHARE

Comments

  1. Arundhati

    Jul 8, 2016

    Reply

    V. Informative & usefull

  2. Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!