Free SMTP Server: Setup With Postal | Step by Step Guide

Ads.01

Free SMTP Server: Setup With Postal | Step by Step Guide

Free SMTP Server: Setup With Postal

In this simple Step by Step Guide, I will show you how to set up a free SMTP server using Postal, the open-source SMTP software, and connect it to your email marketing application to send unlimited emails at no extra cost to service providers.

You can use this guide to learn how to set up and configure the SMTP server using a free open-source software called “Postal“.

To clarify, Postal is a fully-featured open source mail delivery platform for incoming and outgoing e-mail. Overall gives you all the tools and features needed to build a complete mailing system for your business.

Introduction to SMTP and VPS Servers

So what’s the SMTP?

Simple Mail Transfer Protocol

Any Email Marketing System (EMS) is consists of two parts:

  • 1-The sender: (SMTP) is the technical tool that allows you to send emails over the Internet. Therefore, we communicate online by setting up or acquiring an email marketing system.
  • 2-The Email Marketing Application (EMA): allows you to configure your email lists. Also manage marketing campaigns, monitor, analyze results and manage your sending servers.

In order, we connect both together to get an Email Marketing System.


Email marketing system

Now that everything is clear, we are going to learn how to build the first part of any email marketing system, which is the SMTP server.

After creating your own server, you will be able to send more emails once your own server is up and running and you can handle resources. So when you have more (CPU and RAM). Of course you can Send Unlimited Emails.

Setup the SMTP Server, Let’s Get Start!

Well, So Let’s start the work! However, you must first know what is required.

Requirements to Setup SMTP Server.

So as to Build and setup an SMTP server, you will mainly need two things:

  • First: A domain name
  • Second: VPS server with port 25 opened.

First: A domain name

When you send emails, you will be send from an email address like this one

hello@toolsem.com

You will need a domain name to send emails from your SMTP server. If you don’t have a domain yet, go and get one NOW!. In order to continue the setup.

So in my case, “toolsem.com” is the domain name that I use to send my emails.

How to get a domain?

As can be usually seen, it is your website domain name, except if you are working with cold emails, then it’s better to get and use another domain in case it got blacklisted, to keep your main business domain safe.

There are many DOMAIN REGISTRATION PROVIDERS where you can get a domain from like:

Got a domain now? Great!

Let’s continue.

Second: VPS server with port 25 opened.

The second thing is that you will need a VPS server. A public server to install and Setup SMTP on.

What is a VPS server (Virtual Private Server)?

To explain, if you don’t know what a VPS server is, it’s simply a computer (a server) running in the cloud that you buy from a web hosting or cloud services company. And through a public IP address can be accessed.

In addition, a VPS can be used to host your websites with higher performance and can also be used to run a machine 24/7 in the cloud to do any task you want.

To emphasize, in this subject, we will be using the VPS server to build an SMTP server.

Choosing a VPS Provider with Port 25 Support?

To clarify, VPS must have port 25 opened, ًًWhat does this mean?

On the other hand, we do not want to delve into the technical stuff but in short, any network service or software uses a certain port to communicate over the internet or network. Examples:

  • #. Using RDP over port 3389. Works for remote connection to another Windows machine.  
  • #. SQL database systems like MYSQL run on our computer via port 3306.  
  • #. It uses port 22: Connecting to a Linux machine remotely to manage it with SSH.
  • #. We use port 80 when you are browsing the web, opening websites, and so on.

To be more clear, by default, all servers and computers have a running firewall that blocks all ports except the ones you want. So in order to use a particular service, we need to open that port in the firewall.

Moreover, ports can be blocked and opened in two ways, incoming and outgoing, by looking to the following diagram will show you things clearer:


Inbound and Outbound Ports.

Since, we are building an SMTP server, and the SMTP software or protocol communicates over port 25. so we need to have port 25 opened.

With this purpose in mind, when you get a VPS server ensure that the company allows Port 25 and does not block it. On the other hand, some companies do this to protect from spammers.


Port 25 is used to send emails

A list of some companies that allows port 25 by default

Are there any more Companies? Yes, simply you can contact the support of any company you want and ask if they block any ports by default. If not, that is great for you can go with it.

Or start with Contabo, which I think is the cheapest VPS service that you can use.

Without a doubt, feel free to use any VPS company you want. It will be up to you!

So long as you are selected your VPS company, this time create a VPS Server with the following specifications:

Firstly:  Ubuntu 18 x64 as your operating system

Secondly: You can start with 1 CPU/2 GB RAM (And resize later).

Got your VPS? Great Let’s continue.

Configuring Your VPS Server

VPS Server basic configuration

In the same vein, for the tutorial purpose: Any name you choose can be used for the domain and subdomain. Since my main domain is mexxmailling.com and “postal” is the subdomain, I will set up my postal server on postal.mexxmailling.com

At this time, now we have our new Ubuntu VPS server, let’s prepare it for setup.

Also, you can connect to your server using an SSH client like putty or bitvise. First, check your hostname:

hostname -f

If you do not see a form looks like ANYTING.YOURDOMAIN.COM, then you need to change the hostname with the following command:

sudo hostname host.domain.tld

Where the host is whatever you want. In this situation, my sample domain for this tutorial is mexxmailling.com, and the subdomain for the setup is “Postal” then a command will look like this:

sudo hostname postal.mexxmailling.com

Map your domain name.

Now that it’s you have your VPS Server and you set its name. you have to go to your Domain Provider and map your Domain to your VPS server. Just you have to do is open the DNS management zone and add a new A record like this:

host: server points: YOUR SERVER IP.


Godaddy a record

That is for the server name for my case. You can choose whatever you want for your server name.

Done? Let’s continue.

Setting Up a Free SMTP Server with Postal

Installation and Configuration of Postal SMTP

Now that the VPS is ready, we can start the installation process. In addition to setup an SMTP server on our VPS, we need to install SMTP software.

Install Postal Free SMTP Software

Prerequisites

To explain, Postal runs entirely using containers, which means to run Postal you’ll need some software to run these containers. I recommend Docker for this function, but you can use any software you want. Use the following commands to install Docker. (NOTE: Don’t Forget Each Command Starts with a – )

-sudo apt-get update-sudo apt-get install \    apt-transport-https \    ca-certificates \    curl \    gnupg \    lsb-release-curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg-echo \  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null-sudo apt-get update-sudo apt-get install docker-ce docker-ce-cli containerd.io-sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose-sudo chmod +x /usr/local/bin/docker-compose-docker-compose --version

System Utilities

A few system utility that you need to install before you are able to run some of the Postal commands.

apt install git curl jq

Git & installation helper repository

So as to, make doubly sure you have git installed on the server by running below commands.

-git clone https://postalserver.io/start/install /opt/postal/install-sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal

Maria DB

In order to be able to run MariaDB in a container, if you have Docker, use this command. Copy and paste all this into the Putty.

docker run -d \   --name postal-mariadb \   -p 127.0.0.1:3306:3306 \   --restart always \   -e MARIADB_DATABASE=postal \   -e MARIADB_ROOT_PASSWORD=postal \   mariadb

For information, this will install your postal database on MariaDB.

RabbitMQ

In this situation RabbitMQ is responsible for dispatching messages between different processes. As with MariaDB, there are other ways for you to install this. In this for our guide, we are just going to run a single RabbitMQ worker. Only copy all the below as one command and paste on putty.

docker run -d \   --name postal-rabbitmq \   -p 127.0.0.1:5672:5672 \   --restart always \   -e RABBITMQ_DEFAULT_USER=postal \   -e RABBITMQ_DEFAULT_PASS=postal \   -e RABBITMQ_DEFAULT_VHOST=postal \   Rabbitmq:3.8

Installation

Now run the command below and replace postal.yourdomain.com with the actual hostname you want to access your Postal web interface at. Before continuing, Make sure you have set up this domain with your DNS provider.

postal bootstrap postal.YOURDOMAIN.COM

In our case, it is : postal bootstrap postal.mexxmailling.com

Initializing the database

To do this, run the following commands to create the schema and then create your first admin user.

postal initializepostal make-user

Running postal

In this time, you are now ready to run Postal. You can do this by running:

postal start

This will also run a number of containers on your machine. You can use postal status to see details of these components.

Installing WEB Client

In the same way you can use any web client to run postal on your web, but in this guide we are going to use Caddy. Let’s install it with an SSL using the below command.

docker run -d \   --name postal-caddy \   --restart always \   --network host \   -v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \   -v /opt/postal/caddy-data:/data \   Caddy

On the other hand once this has started, Caddy will issue an SSL certificate for your domain. Meanwhile, you will be able to immediately access the Postal web interface and login with the user you created in one of the previous steps.

Configure Postal SMTP

Now in this step, open your Internet browser, and navigate to your Server IP URL or Subdomain like this:

http://YOUR_SERVR_ADDRESS

Don’t worry, you will notics an SSL warning. OK, proceed as you see in the image below:

SSL warning

SSL Warning image


Postal Login Screen will open to log in, then enter your email address and the password you created during setup.


login: Postal

Postal Login

After login inside Postal, click on Add Organization to add one.

And then Click on Build Mail Server and enter the name, and set it to live mode



Create Postal Mail Server

So Simple!!.

Postal Domain Configuration

Now in this moment, Click On Domains to add your domain name into Postal


Add domain in postal

Add Domain in Postal

Now enter your Domain name that you want to use to send emails, and Click Create Domain.

Postal will show you the Domain page with the records that you need to configure.


Postal DNS records

In the same vein, what you need to do is to copy these records and paste in your DNS Zone. Then your server will be ready to send emails! But you want to know What are SPF and DKIM?

Dkim (DomainKeys Identified Mail) :

Let’s first start with DKIM. What is a DKIM? A DKIM record is also a text record in your DNS that contains a public authentication key. Through this key will be validated using a private key kept privately within your server.

Also, through it all emails will be signed. So, this will avoid any modifications and protect your authenticity. That is very important for your server to archive high transmission scores. On the whole, see our blog post for more information:

Also you may be interested in reading more. See here our blog post to read more about DKIM: What is DKIM? What is the benefit? Why need DKIM?

Setup Dkim For Postal

It’s nice, because Postal already has DKIM set up and the keys generated; all you have to do is copy the DKIM record into your DNS zone.

SPF (Sender Policy Framework):

After we got to know DKIM, we need to Know SPF: An SPF record is a TXT record that is added to your Domain DNS Zone and allows you to set the mail servers that are allowed to send emails from your domain.

To clarify, messages sent from a server that isn’t included in the SPF record will be marked as spam or rejected.

As an example in this case, you can’t send an email from your own server and set your sending email as “mail@google.com,” you can’t use google’s domain. Because, it indicates that you are trying to send spam.

You can configure SPF and stop anyone from using your domain to send emails. Therefore, setting SPF is very important and makes your domain trusted by other mailing providers.

SPF Setup: Open your DNS zone in and add the following record:

v=spf1 a mx ip4:XXX.XXX.XXX.XXX -all

Replace with your VPS server IP.

Now your server can send emails just from your domain.

Postal will give you an example SPF to copy, and it looks like this:

v=spf1 a mx include:spf.postal.example.com ~all

May be want to read more about SPF, please visit our blog post What is SPF: Sender Policy Framework?

This is simply an example domain, and you will need to change this in the postal config file to match your domain name. How?

Edit Postal config file

You can access to edit the POstal Configuration File, will need to connect to the server using a File manager. Therefore, you can use WinSCP, a free remote file manager, to connect and edit the files on the server.

Open WinSCP and connect to your server with the root credentials. After open WinSCP go to the: /opt/postal/config Directory. Then open the postal.yml file.



Postal yml configuration

If WinSCP is not working with you, you can use VIM or VI commands using Putty.

Postal yml configuration

Then, right-click and edit the file.



Postal domain change

Postal domain change

As you can see, you need only change the example.domain with your domain name.

After that, restart Postal for the configuration to take effect.

So, use the SSH client (Putty) to run this command on your server

postal restart

Postal SPF record

Nice Done! You have succeeded in progress.

Our server is now ready for testing.

Testing Your SMTP Server

Finally! Sending a Test Email

Now, Postal has built-in functionality to test sending emails. Click on Messages, then on Send Message to test out Free SMTP server!

Wow!

On one side, you may be asking how to use this SMTP as a relay to send emails from any email marketing application.

Simply! The answer is through creating “Credentials” inside Postal to connect and authenticate to our Free SMTP Server.

Create Postal Credentials to Relay Emails

To create credentials, simply click on Credentials, then Add new Credentials.


For the Type, Select SMTP

For the Type, Select SMTP.

To point out: You can select an API if you wanna connect to postal through the API or develop your own application that works with Postal. Read more about the API here.

Enter a User (whatever you want).

And the Key, is the password, can keep it as “automatically generated“


Credentials inside Postal

And that’s about it! Now you can use these credentials in any email marketing application.

Relay a Test Email

Simple, Visit SMTPER.NET and enter the following details for your server:


Test your SMTP

Test your SMTP using SMTPER

  • SMTP Host: Your Server Domain or IP.
  • Port: 25 or 2525
  • Login: The user whose credentials you entered in. 
  • Password: The User Password.

So now, you can use these credentials in any Email Sender Application.

Great! I hope everything was simple and clear. We finished setting up the Free SMTP Server!

Before You Send!

Congratulations! Using Postal, you Setup your own Free SMTP Server.

All things considered, before you start sending emails, you have to understand some guidelines to get the best delivery rates and reach the inbox!

Warming Up your SMTP server and rDNS

With this intention, When you build a New SMTP Server with a new IP Address, and Before You can Start Sending Your Email Marketing Campaigns, warm up your IP Address.

What is Warming Up IP?

With attention to when you have a new brand IP address for your SMTP, this IP will have no reputation on the internet, and ISPs (internet service providers) don’t know this IP.

In other words, IP warmup is the practice of building Your Reputation on The Internet by gradually increasing the volume of mail sent with your IP address according to a schedule.

The table below an example of warming up your server:


Example of warming up your server

This table shows you a scenario if want to send 5K emails per day. But We recommend starting by sending a low volume of emails. Then work your way up to a more significant amount.

Also can read more in our blog post about improving your email deliver-ability.

rDNS (Reverse DNS):

That is to say, the reverse DNS is a pointer record and is used to point your IP to your Domain, its the inverse of the regular DNS A record.

Therefore, when you call the IP, you will get the name. It is also a base factor in setting up your mail server and increasing your sending score and reputation.

DMARC (Domain-based Message Authentication, Reporting & Conformance):

In addition to the above, it is a Protocol that uses (SPF) and (DKIM) to determine the authenticity of an email message.

DMARC makes it easy for Internet Service Providers (ISPs) to prevent harmful email practices, such as domain spoofing to obtain recipients’ personal information.

To understand the importance of DMARC for your Online Business and how to set up, please read more in our blog post DMARC Record: How To Add it? here.

MX Record

Mail Exchange (MX) records are DNS records that allow email to be delivered to your address.

That is to say, in simple DNS terms, an MX record is used to tell the world through the net which mail servers accept incoming mail for your domain and where emails sent to your domain should be routed to. You will not receive an email if your MX records are not pointed to the correct location.

Avoid Spam Factors

We have Four main factors the determines your spam score:

  • IP Reputation
  • SPF, DKIM, rDNS, and DMARC.
  • Message Body
  • Email List health.

Until now, the first two factors are explained above (IP Reputation and SPF, DKIM, rDNS, DMARC). We still have Message body and Email List Health.

Message body

Simply the subject and the content of your email. That determines your message score. Does it look spammy? And Does it have any spammy keywords and triggers??

What’s more?. Be sure to avoid any of these while creating your subject lines and message bodies.

Check this article on Hubspot, to learn more about spam keywords.

You Maybe Also Interested in the article “Learn to Avoid Spam Filters with High-Quality Emails”.

Email List Health

Simply two things determined it:

  1. Bounce Rate: How many emails are valid in your list.
  2. Spam Traps: does your list contain any spam traps?

Maybe Also be Interested in the article “Email Verification: Email Address and IP Address”.

Securing Your SMTP Server with SSL (Optional)

Secure with a Free SSL.

To providing extra security for users accessing your application, SSL certificates are used within web servers to encrypt the traffic between the server and client. Here, Let’s Encrypt provides an easy way to obtain and install trusted certificates for free.

Use the Putty SSH client to connect to your server. Let’s start!

Step No.1 Install the Let’s Encrypt Client

Let’s Encrypt certificates:

They are fetched via client software running on your server. The official client is called Certbot.

Install Certbot by running this command:

apt -y install certbot

Now Certbot is ready to use.

Step No.2 Get the SSL Certificate

Before we get an SSL Certificate. First we need to stop nginx service since its using port 80 which certbot will use. Together, Let’s stop it temporarily by running the following command:

sudo systemctl stop nginx

Install the certificate now by running the following command:

certbot certonly --standalone -d postal.mexxmailling.com

Replace “postal.mexxmailling.com” with your domain.

Then follow the wizard. Certbot will issue a certificate for your domain.

Step No.3 Configure the SSL Certificate

Until this time, and after we have got the SSL certificate. We will need to configure it on our server.

Securing with a Free SSL (If Using Nginx)

Let’s start the NGINX service again:

sudo systemctl start nginx

Once again, open WinSCP to edit some files on our server.

Connect to your server, and go to /etc/nginx/conf.d directory.

In this folder, create a new file and name it: “postal.mexxmailling.com.conf“

Replace “postal.mexxmailling.com” with your domain.

Copy the code below, then paste it inside the file.

server {    listen [::]:80;    listen 0.0.0.0:80;    server_name postal.mexxmailling.com;    return 301 https://$host$request_uri;}server {    listen [::]:443 ssl;    listen 0.0.0.0:443 ssl;    root /opt/postal/public;    server_name postal.mexxmailling.com;    ssl_certificate /etc/letsencrypt/live/postal.mexxmailling.com/fullchain.pem;    ssl_certificate_key /etc/letsencrypt/live/postal.mexxmailling.com/privkey.pem;    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;    ssl_prefer_server_ciphers on;    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;    location / {       client_max_body_size 50M;       try_files $uri $uri/index.html $uri.html @puma;    }    location /app/assets {       add_header Cache-Control max-age=3600;    }    location @puma {        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header Host $host;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header X-Forwarded-Proto https;        proxy_pass http://127.0.0.1:5000;    }}

And save the file.

Final step is to restart and enable nginx again. Run the following command:

systemctl restart nginx

Then this command:

systemctl enable nginx

You can now test your secure postal website. That’s awesome! Good luck!

FAQ
How many emails can be sent per day after configuring the SMTP server?

It is best to start by sending a low volume of emails. Then work your way up to a more significant amount. Because of ISPs treat email volume as a key in determining spam.

Why do you require an SMTP server for cold emailing?

Setting up your own SMTP server will allow you to send unlimited emails. Sending free bulk emails is limited to a number of bulk email providers.

What do you have to worry about after you set up your own SMTP server?

Being blacklisted for spam or having your account blocked for sending too many emails.


Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to better enhance your experience. Learn More
Ok, Go it!