Setup SMTP Server: How do I Setup? | Step by Step Guide

Setup SMTP Server: How do I Setup?

In this Step by Step Guide, I will show you how to setup an SMTP server using WHM (web hosting manager) and connect it to your email marketing application to send emails with no limits.

Are you looking to setup your own server using Postal ‘click here’? But in this guide you can learn how to setup and configure the SMTP server using a free WHM (web hosting manager) software called “Webmin”. It’s like “cPanel” but for free!

In simple terms, what is the SMTP server?

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.

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 SMTP Server, Let’s Started!

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.

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


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

Got a domain now? Great!

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.

Port 25 open?

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:

  1. #. Using RDP over port 3389. Works for remote connection to another Windows machine.  
  2. #. SQL database systems like MYSQL run on our computer via port 3306.  
  3. #. It uses port 22: Connecting to a Linux machine remotely to manage it with SSH.
  4. #. 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:

Setup SMTP Server: 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.

Get a VPS Server

Use VPS company

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

Setup SMTP Server-Port 25

Below is a list of some companies that allows port 25 by default:

  1. Contabo.
  2. Digital Ocean.
  3. Host wind.
  4. Interserver.
  5. OVH.
  6. AWS

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.

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.

VPS Server Basic Configuration.

In the same vein, for the tutorial purpose: Any name you choose can be use for the domain and subdomain. Since my main domain is mexxmailling.com.

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

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, the a command will look like this:

sudo hostname server.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.

Domain Provider: 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.

Setup SMTP Server

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 the WHM (Webmin) Software.

We have several SMTP software such as PowerMTA, Postal, Exim, and Postfix.

This guide will use Postfix as an SMTP service.

In order to simplify and automate things I will install a Web Hosting Manager (Webmin) which automatically installs and configures Postfix (No need for manual configuration).

To install Webmin easiest way run this command:

wget http://software.virtualmin.com/gpl/scripts/install.sh

By running this command, the installation script, will be downloaded now we can run the setup:

sudo /bin/sh install.sh

So Simple!

The installation may take a few minutes to finish. Then you will see this success message:

Virtual Setup SMTP Server

Nice, go to open your Web Browser and Navigate to your Server URL To Configure.

The URL will look like this: https:// YOUR_SUB_DOMAIN:10000

Webmin uses Port 10000, so make sure to add “:10000” after your server address.

Note: Port 10000 may be blocked on sometimes by the firewall, so you need to open it.

Upon opening Webmin for the first time, you will see an SSL warning message. Click continue anyway:

Setup SMTP Server- Webmin SSL Warning

After that, you’ll see a login screen like this:

SMTP Server-Webmin login page.

Great! Log in enter your root username and password.

Now will be managed through the Web interface from now on. So Things will be simple.

Webmin Basic Configuration

When you first time log in, you will see the post-installation wizard.

Webmin post-Installation wizard

Webmin post-Installation wizard

Set the options as the below:

  • Preload Virtualmin Libraries: YES
  • Domain Lookup Server: YES
  • ClamAV Server Scanner: NO (It will use a lot of Resources, Turn On if you have a lot of CPU and RAM)
  • Spamassassin Filter: NO (It will use a lot of Resources, Turn On if you have a lot of CPU and RAM)
  • MariaDB/MySQL Server: YES
  • PostgreSQL: NO
  • MariaDB/MySQL Database Size: Medium
  • DNS Configuration: check the box “Skip check for resolvability“, and click next as in the image below:
Webmin DNS configuration

  • Password Storage mode: Choose Any, for Higher Security, Select Hashed.

This time, click on re-check and refresh configuration, and wait for the operation to finish. After you will see this success message:

Webmin post wizard success message


Create your Free Business Email

Our server is now ready for the actual work, and we can create the business email address we’ll use as the sender address. To do so, we must create a virtual server inside Webmin using our Domain name.

Create Virtual Server

On the screen upper left corner, as shown in the image below, click “Create Virtual Server”:

Create a virtual server

Now simply fill your domain name, a description, and a password for this virtual server.

Enter your details – Create Server

And Click Create Server.

Create the User Account Email Address

Now we have a virtual server click on Edit users to the left.

Create user

Now click “Add a User to this server“, the new user wizard will open:

Virtual domain user detials

Enter any Email you want, like support, hello, mail, admin, or business email you want. Then Enter the name and the password.

Then click Create.

Now you have a Free Business Email!

If you are looking to create a free business email with Zoho Mail, click here.

Now Your SMTP Server is now ready.

Before You Send. Understand some guidelines

Congratulations! Using Webmin, you Setup your own 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: 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:

Warmup server table

This table shows you a scenario if you want to send 1.2K reputable emails per day.

Configure SPF, DKIM, rDNS, DMARC, and MX.

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.

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. This will avoid any modifications and protect your authenticity. That is very important for your server to archive high transmission scores.

See here our blog post to read more about DKIM: What is DKIM? What is the benefit? Why need DKIM?

Setup Dkim For Webmin Postfix:

Dkim needs to be configured on our Server First, then copy the public key to our DNS zone.

Then Click on “Domain Keys Identified Mail” under “Email Settings

DKIM Setting.

Next, click Install Now. Once the installation is complete, go back to “Domain Keys Identified Mail” and you will have the options to generate your keys.

Generate Dkim Record

Keep the Defaults, and click Save.

After that, Click on DNS records under Server Configuration.

DKIM Setting: DKIM record

Only you need to copy the DKIM record into the DNS zone of your domain. In my case it is Godaddy.

DKIM configured? Great!

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 here Dmarc record: How to add it.

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.

Set the MX: Create a new MX record in your DNS Zone and point it to the domain of your server as follows:

Set MX record

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 & SPF, DKIM, rDNS, DMARC). We still have Message body and Email List Health.

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 this article learn avoid spam filters.

Email List Health

 Simply two things determined it:

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

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

Send a Test Email

We are ready to send our first email. Our SMTP server was setup. How to test our server?

Go to SMTPER.NET and enter your server details as follows:


  • SMTP Host: Your Server IP or Domain.
  • Port: 587
  • Login: The Email Account You created.
  • Password: Your Email Account Password.

I hope everything was simple and clear. We setup the SMTP Server!

How many emails can I send hourly or daily basis?

If you have a dedicated SMTP server, you can send as many emails as you need on an hourly or daily basis. So you don’t have to worry about sending too many at once. No email service providers and internet service providers (ISPs) limit your daily emails.

Can I see if my email went to the recipient?

You can see if your email went to the recipient and examine any error codes. No matter what happens to your email after you hit send, you will receive helpful delivery details and information.

What after I set up and run my own SMTP server?

If you run your own SMTP server, you don’t have to share your email list with anyone. Also, you will maintain your company and your customer’s privacy.

Update cookies preferences