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

H

Requirements:

  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. 

hostenger-domain-pricing

Hosting:

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 > aws.amazon.com 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.

create-ec2-instance

Click on Instances.

instance-creation-steps

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

centos

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

os-selection

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.

aws-smtp-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. 

key-pair

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.

elastic-ip

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.

elastic-ip

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.

load-key-pair

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.

putty

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

putty

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.

putty

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
perl-install

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.

a-record

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 https://securedownloads.cpanel.net/latest
sh latest
cpanel-install

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.

whm-login

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.

cpanel-id

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

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

whm-one-time-login

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.

change-root-password

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 hungryblogger.in domain.

create-account

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.

fill-info

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

email-account

Click on Email Deliverabity > Manage.

email-deliverability

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.

dkim-record

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.

spf-record

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

Host: _dmarc

VALUE:

v=DMARC1; p=quarantine; sp=quarantine; rua=mailto:admin@hungryblogger.in; ruf=mailto:admin@hungryblogger.in; pct=100; fo=0:1:d:s;

Note: Use your Email ID.

For Google Postmaster verification: Go https://www.gmail.com/postmaster/

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 mail-tester.com and Copy the Email ID.

email-test-score

Next go to cpanel

> Email Accounts

> Click on Check Email

> Open Round Cube

> Click on Compose.

compose-mail

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 mail-tester.com and click on then check your score.

email-sending-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
create-new-email

Click on create.

use-new-email-as-smtp

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
connect-your-smtp

> Click on Connect Device

credintials

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

test-credintials

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

13,351 comments

  • Pigeons travel and feed in large flocks and often use the identical nest multiple
    instances. Providers that supply versatile service options keep you from getting stuck with an IT strategy that’s outdated, and they
    finally stop the need to have a roster of a number of service providers
    utilizing one provider to cover for the failures of one other.
    5. Bird repellent: It has 13-inch long plastic base together with a number of stainless
    steel wires that stick out upwards in four completely different angles.

    There are plastics insulating your electrical
    cables and carrying water and waste-water in and out of your house.
    Photograph: A small collection of the lots of of plastic things you’ll
    find in your house. In buildings, you’ll find
    plastics in issues like secondary glazing, roofs, heat insulation and soundproofing, and even in the paints you slap in your partitions.
    Why, with all of this disaster, dad and mom would even think of shopping for their kiddies 4 wheelers?
    Up to a 3rd of all the plastic we use finds its means into the packaging
    we use to protect products (sometimes even plastic products) on the journey from factory to house.
    There’s all the time that further air of elegance surrounding your house
    or workplace when you’ve got an immaculately mown lawn.

  • Every weekend i used to go to see this web page,
    as i wish for enjoyment, since this this website conations actually good funny
    stuff too.

Debojyoti Das

Get in touch

You can also connect with me on social media platforms.

Get a weekly email with best free content
Subscribe