How to build your own SMTP Server using AWS for free?



  1. One Domain
  2. AWS Account
  3. Putty
  4. Putty-gen

If you already have a domain, you can create a subdomain and use that, or else you can buy a domain from Godaddy, Hostinger, or Namecheap.

If you buy a domain from Hostinger, it’ll cost you around Rs. 75/year. 



You can use a VPS or a Dedicated Server to host your SMTP Server.

VPS Options Available: AWS, Contabo, Linode, Hostinger, Hostwinds, Digital Ocean, etc

[ I won’t recommend Digital Ocean because all their IPs are on Blacklist. ]

Dedicated Server Options Available: Kimsufi, One Provider.

Why I’m using Amazon AWS?

  • It’s free for one year (750 hours).
  • AWS provides IP addresses with a good reputation.
  • You can manage the Reverse DNS.

STEP 1: Download and install these two Software:

STEP 2: Create an AWS Account.

How to create an AWS free tier Account?

1. Open Browser and type > and press Enter.

2. Sign-up using an Email ID. 

3. Add contact information.

4. Add Payment Information. 

5. Confirm your identity.

6. Log in to your AWS console.

Note: You can use Credit Card or Debit card to Sign-up, if you are using a debit card to Sign-up then Rs 2 will be deducted from your account to verify the bank details. Use the OPT and complete the Sign-up. Your Bank will refund Rs 2 on your account within 48 hours.

STEP 3: Create an EC2 instance.

Type EC2 on the Search bar then choose the first option and click on Dashboard.


Click on Instances.


Click on ‘Launch Instance’ then type ‘CentOS 7’ on the search bar.


Click on Select button

> Click on Continue.

> Click on Next: Configure Instance Details

> Click on Next: Add Storge

> Click on Next: Add Tags

> Click on Next: Configure Security Group


Here, you must open some ports like SSH, HTTP, HTTPS, SMTP, SMTPS, POP3, POP3S, IMAP, IMAPS, DNS (TCP), DNS (UDP), MS SQL, TCP PORT 2087 or you can open ALL TCP PORT.


Then, Click on ‘Review and Launch’

> Launch

> Select Create new key pair from the dropdown menu.

Then give a name and download the keypair. 


Now, click on ‘Launch Instances’.

STEP 4:  Create an Elastic IP and associate this Elastic IP to the CentOS 7 instance.

On the left-hand side of the EC2 dashboard, use the scroller and Scroll down. You will see the Elastic IP option under Network & Security. Click on Elastic IP and follow the steps.


Click on Allocate Elastic IP 

> Click on Allocate.

Then click on the newly created IP address from the Elastic IP dashboard.  

Associate Elastic IP address

Now, you need to check weather the IP is on blacklist or not. If the is on blacklist then release the IP and alocate a new IP address.
Go to MX ToolBox > Click on Blacklist > Paste the IP address > Click on Blacklist Check.

Now, click on the Instance field and select the centos-7 instance-id we created. Then click on Allocate.


Note: To solve the Dynamic IP Address problem, you must assign an Elastic IP to the EC2 instance. Otherwise, you will not get a 10/10 email sending score. By default the Port 25 is blocked. You need request the AWS team to open the port 25. It’ll take maximum 24-48 hours, to request click here.

STEP 5: Installation of SMTP SERVER

For our SMTP we will use WHM & Cpanel. You can send unlimited Email Campaigns after hosting the WHM & Cpanel on the CentOS EC2 Instance.

Let’s get started-

Open Putty-gen

> Click on Load

> Then, select All Files from the dropdown menu.

Choose the key file (.pem) we download while creating the instance. Now, don’t click on Generate. Just click on the save option. Give a file name and save the file.


Now, to use the SSH connection we have to use Putty.

Click on the instance from the EC2 dashboard. Click on the EC2 instance we created.

You can either copy the IP address or you can click on connect.

Click on the Copy icon on Point no. 4 under Instance ID.

Now, Open Putty.

Either paste the IP address or the hostname (from Instance ID point 4) in the Host Name field under session.


Then click on Data and type the username. By default, the username is centos.


Then expand the SSH menu by clicking on the + icon and select Auth. Now, click on browse and select the .ppk file we created using Puttygen.


Now, click Open. A popup will appear with Putty screen. Press Yes.

Now, go to the root using command.

Sudo -i

Install Perl

yum -y install perl

Now, we’ve to change the hostname.

To check the hostname type ‘hostname’ on putty and press Enter.

Go to Domain Management Dashboard

> Click on Manage DNS

> Create a subdomain

Add ‘A Record’

> On the Host field: ‘@’

> On the Points to field: Paste Instance IP address.

> Click on Save.


Now, set the hostname.

sudo hostname {subdomain}.domain name

Now, change the directory using

cd /home

To install the WHM & Cpanel run this command

curl -o latest -L
sh latest

After the installation is done. You can get the URLs from Command Line.

It will provide two URL. One is the one-time login link, and we will use the other link to login after we change the root password.


Just copy the link. Paste the URL on the browser and open the link.

Here we need a email id to sign-up with cpanel account.


Open your email, click on the link to verify and set the cpanel password.

Now, Go to Putty and type ‘whmlogin’ then press enter.


It’ll will give us another one-time login URL. Copy the URL and open it on another tab and proceed next.  

> Login with cpanel

> Press allow.

Here, before rebooting the WHM we need to change the root password. You can see a search bar on the left-hand side. Just Type change password. Now, change the root password and reboot the WHM.


After reboot, Login to you WHM Account.

URL: Subdomain name.{domain name}:2087/

{WHM uses port 2087}

By default, the username is ‘root’, use the new password to login.

Now, we need to create an account. I am going to create the account using my domain.


Just fill in the domain information, use your domain and give one username and password and also you need to provide an email address. After filling in the Domain information, just scroll down DNS settings.

Make sure you tick the check box > Use the nameservers specified at the Domain Registrar. And click on Create.


Now, refresh the page and click on List accounts. Click on Cpanel icon.


Click on Email Deliverabity > Manage.


You need to add these records to your domain settings.

For DKIM Record: Copy the Name field up to domainkey and go to DNS Settings and create a txt record

and paste it. Again go back to Cpanel Email deliverabity and copy the Full DKIM value then again go to DNS settings and paste it on the TXT Value field. Click on Save.


For SPF Record: Go back to Cpanel Email deliverabity and copy the Full SPF value then again go to DNS settings and create a TXT record, on the TXT Value field paste it. On the Host field just give a ‘@’ sign and Click on Save.


To add a Dmarc Record: Go to manage DNS and create a txt record

Host: _dmarc


v=DMARC1; p=quarantine; sp=quarantine;;; pct=100; fo=0:1:d:s;

Note: Use your Email ID.

For Google Postmaster verification: Go

Click on get started 

> Sign in using your Gmail ID 

> Click on the Plus button 

> Enter your domain 

> Click Next 

> Copy the TXT record 

> Go to your DNS settings 

Create a txt record

Host: @

Value: Paste the value you copied from Postmaster.

> Click on save.

Go back to Google Postmaster Tools and click on Verify.

Now, we’ll test the SMTP and Check the email Sending Score. Go to and Copy the Email ID.


Next go to cpanel

> Email Accounts

> Click on Check Email

> Open Round Cube

> Click on Compose.


We need to send an email to the email id we got from the mail-tester. Just write something on the subject and the body and hit Send.

Go to and click on then check your score.


As you can see, we have got 10/10.

How to create a new email Id and use it as a SMTP server?

  • Go to cpanel.
  • Click on Email Accounts

Click on create.


Enter a username and password. Then click on create.

Username examples: info, support etc.

How can you connect this SMTP with Email Marketing Application?

  • Go to Cpanel
  • Click on Email Accounts

> Click on Connect Device


From here you’ll get the SMTP credentials. To test the credential, you can use


Note: Use Port 587 for outgoing emails/ sending emails. Make sure the connection is secure, use TLS, and enable authentication.

About the author

Debojyoti Das


  • Thanks for your videos, it’s very helpful to me. but there’s one more problem;
    after pasting the WHM install link, it asked me to enter a username and password to login. but Aws never provided a password for me while creating the instances.
    Please i would appreciate your kind response.

    • By default, the username is ‘root’. For first time login, you need to request one-time login URL using Putty. Just type the command ‘whmlogin’ and press enter.
      You’ll get an one-time login URL. Use that URL to login and then change the root password.

  • I’m not certain the place you’re getting your
    info, however great topic. I needs to spend some time learning more or
    working out more. Thank you for wonderful information I
    used to be looking for this info for my mission.

  • Good day! This is kind of off topic but I need some help from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I
    can figure things out pretty fast. I’m thinking about making my own but I’m not
    sure where to start. Do you have any ideas or suggestions?

    With thanks

Debojyoti Das

Get in touch

You can also connect with me on social media platforms.

Get a weekly email with best free content