Updated: Aug 9, 2020
In this Step by Step Guide, We will see how to set up a Free SMTP server using Postal, the open-source SMTP software, and connect it to your email marketing application and by after building our own SMTP server, And using we can send Unlimited Emails*.
There are many ways to build SMTP servers, Today we will see how to build the SMTP server using open-source software called “Postal“.
Postal is a fully-featured open source mailing platform to build an email marketing platform for your business.
What is the SMTP Server?
Simply, SMTP is a protocol that allows you to send emails over the internet.
SMTP stands for “Simple Mail Transfer Protocol”. And by using this protocol on a server we can send and receive emails from all over the world via the internet.
Any Email marketing system includes two parts:
SMTP Server (The sender/receiver): This is a server that is specifically configured to send and receive emails on the internet.
The Management Application: where you can configure and connect your SMTP server to send and receive emails and manage your customers (Email Lists).We can also create Email Campaigns, Monitor and analyze results, Manage your delivery servers, etc.
Combined together we can use this setup for email marketing.
Why set up your own SMTP server?
There are are many companies out there that provide mailing services at some cost the best part with these systems is that we don't have to put efforts in the technical part you just need to pay and use their service.
The big issue with this is these services are not cheap and also the cost increases as the requirement grows. At some point like for small businesses, it is good to use such systems but if you have a big business or need to send so many emails then you must consider building your own email marketing setup. It is cheap and not as hard as it sounds. So without further ado lets get started.
Requirements for SMTP Server.
Domain name: When you're sending business emails, We need an email address like firstname.lastname@example.org.
Server or a VPS server: A server is used for sending and receiving emails via SMTP protocol.
What is a VPS server?
A VPS is a virtual server that is just like a physical server which is running on a cloud that you can buy from a hosting service. the only difference between a physical server and a VPS is that a VPS is installed on a physical server as a part of a big server it is just a virtual machine acting as an individual entity. You do not need to worry about the performance
VPS is fast and responsive based on the hardware components and configurations.
For any server we use, the important thing is we need PORT 25 open in order to send and receive emails because SMTP protocol uses port 25 just like the way HTTP uses port 80.
As a starting point, you can use Ubuntu 18 x64 as your operating system and 4 CPU Cores/ 8GB RAM (And resize later)
VPS Server configuration:
[From now on just copy and paste commands as it is to perform the mentioned operation.]
After installing putty put your server IP address as shown in image above and click on OPEN after that you'll get connected to your VPS server via a terminal there it'll ask you for username and password of your VPS login there and now you're ready to fire some commands on it.
Now check the hostname :
If you don’t see a form of subdomain.yourdomain.com, then you need to change the hostname using the following command:
sudo hostname host.domain.tld
Where the host is any subdomain you want to use. so in my case, my sample domain for this tutorial is postal.primeclick.net, the command will look like this:
sudo hostname postal.primeclick.net
After this you need to map your hostname to your server IP to do so you have to add A record in the DNS management zone of your domain provider. an example is shown below (using Google domains)
The VPS is now properly configured, and we can start the installation process. So in order to set up SMTP Server on our VPS, we need to install an SMTP software that is postal.
In case if you're using Contabo VPS you need to run the below command on your VPS before starting
sudo apt-get install apt-transport-https
Next, for postal installation run below command on your VPS:(It's a one-line command so copy all and paste as it is)
curl https://raw.githubusercontent.com/atech/postal/master/script/install/ubuntu1604.sh | sh
Now, wait for the installation to complete it'll take a few minutes to complete the installation process. When it's done it'll show the message as “Installation complete“
Now We need to create a user that will be used to login and manage everything on postal by using below command:
After hitting enter it'll ask you for your Name, Email, and Password. after entering all the data hit enter and now our Postal installation is finally completed. EASY!
Now we need to configure the postal in order to use it and connect it to a mailing application.
To do that open your browser and in URL navigation bar type your VPS IP address or your subdomain and hit enter.
http://X.X.X.X OR http://postal.primeclick.net
It'll show you a warning as our server is not protected because of the SSL certificate is not installed. Just proceed anyway to the site we'll add the certificate later.
Now the postal login window will open here enter the credentials of the user that you created at the time of postal installation.
Now you're inside postal, Click on "ADD ORGANIZATION" to new and then click on "BUILD MAIL SERVER", Now enter the name and set the mode to "LIVE".
Now we need to add our domain in the postal
Enter the domain name which you want to send email campaigns from and click on "CREATE DOMAIN"
Now some DNS records will appear as follows:
We need to add these records to our DNS management zone but you'll notice that in SPF RECORD it is showing domains as
v=spf1 a max include:spf.postal.example.com ~all
We need to change this example.com domain to our own domain in my case it is primeclick.net in order to do this we will need to edit the configuration file of postal.
Edit Postal configuration file:
We will use WinSCP to connect our VPS and browse to locate the config file. just download the application. It is free and small in size also very easy to use.
Next, Open WinSCP, and Connect to your VPS using the root user credentials. and go to: /opt/postal/config Directory. Then open the postal.yml file.
Right-click on it and edit the file. there you'll see the records like
smtp_server_hostname: postal.example.com spf_include: spf.postal.example.com return_path: rp.postal.example.com route_domain: routes.postal.example.com track_domain: track.postal.example.com
Here just replace each example.com domain with your own domain in my case it is primeclick.net, So the records will look like
smtp_server_hostname: postal.primeclick.net spf_include: spf.postal.primeclick.net return_path: rp.postal.primeclick.net route_domain: routes.postal.primeclick.net track_domain: track.postal.primeclick.net
We need to restart the postal in order to make the effect of file changes.
Next, go back to your browser where we left before REFRESH the page and you'll notice that the "spf.postal.example.com" is changed to "spf.postal.primeclick.net".
now add those SPF and DKIM records to your domains DNS zone.
Everything is done! Send a Test Email
Postal has a built-in feature to send test sending emails, Just click on Messages, then on Send Message to test out Free SMTP server!
Just enter the FROM as your sending email address and in TO enter the testing email id where you'll receive the test mail. Now that's it! just connect your mailing application like Mailwizz, Mautic, or Pabbly, etc, and use your FREE SMTP server for unlimited sending.