How to setup your own mail server.
Published: 2024-05-29 12:37:03

Well, recently I have been asked to explain more about running your own mail server.

Before going further I have to tell you this one is not an easy one for multiple reasons.

Your mail server has to pass many qualification to be qualified as a known mail server for other mail servers like Gmail, outlook and many more.

One of the most important factors is your IP, first of all your IP should not be back listed. There are many sites out there you can use to check if your IP is black listed; like this one.

You might be wondering why an IP is black listed, the answer is simple, that IP has been abused by someone else, and it’s now black listed.

The best option is to ask your provider, to pass a brand new IP to you, to make sure that IP is not black listed.

Another important factor is your DNS settings.

You have to go though many DNS records such as DMARC, DKIM and many more records.

Which needs to be configure and set one by one which I personally found it difficult and time consuming.

Otherwise almost all your emails either will not get delivered, or will be delivered to spam box not the actual inbox.

Apart from these, you need to install a couple of packages and configure it manually which is also time consuming.

There are many solutions to setup a mail server, but the most common one is:

Postfix: A mail transfer agent (MTA) that routes and delivers email. It’s lightweight, fast, and configurable.

Dovecot: Provides IMAP and POP3, which allow mail clients to read emails from the server.

MySQL: Stores information like domains, virtual users, passwords, and mail aliases.

ViMbAdmin: A web interface for mailbox administration that lets you add and remove domains and mail users.

Amavis: A content filter that checks emails for spam and viruses using other packages.

ClamAV: A free antivirus for Linux.

Spamassassin: A spam filter.

Sieve: A mail filtering language.

RoundCube: A webmail interface for mail users.

Nginx: A web server for ViMbAdmin and RoundCube

Well I don’t Recommend you to go though all these confirmations, unless you have to for some reasons. But what to do?

- One solution is to go with a cloud mail server and just buy it from a mail provider for a couple of dollars per month.

- Another solution is to use mailinabox script done by Joshua Tauberer. This is an awesome all in one solution, you just install an OS, run this scripts and that’s it.

Link to its YouTube video

It will install and configure all packages you need for a mail server. Also has a great admin panel in which you can login and manage your domains, DNS settings and users.

It will install nextcloud on that server, but there is an option to pass into that script in order to skip the nextcloud installation.

The downside of this mail server which I don’t Like is that, you can not use that server for any other purposes and it has to be dedicated to your mail server.

Note: once you are done with the mail server, try to use this website and see your mail score.

Browsing this link will return an email address, you send a fake email address to this, then you come back to this website and see your score.

If you get higher than 9, most probably you are good to go and 90 percentage of your emails will deliver to inbox not spam box.

From. My own experience;

What ever you do, when it come to send emails to outlook email address , your email will drop into spam box anyway, disregarding how good and professional your private mail server is.