Building an SMTP server with iRedMail could be a little tricky for beginners. But it’s still easy compared to building SMTP with mailcow or Postal. If you are looking for the easiest way to build your own SMTP server then perhaps you should check building SMTP server with Mailinabox.
iRedMail is an open-source mail server script with a very good number of developers contributing to its development on GitHub. It is free of cost but if you want an advanced admin panel to manage users then you have to pay for it, though the basic admin panel is free.
Features of iRedmail
iRedMail comes with inbuilt Webmail, Calendar, Contacts, ActiveSync, Antispam, Antivirus, greylisting, whitelisting, blacklisting, etc. It also supports MariaDB, PostgreSQL, OpenLDAP backends. This means you have complete freedom to choose the database type.
Perhaps iRedMail is the only mail server solution that can be installed on all versions of Linux. So, here also you have the flexibility to deploy iRedMail on your favorite Linux distribution.
Like every mail server, you will need
- a domain from Namecheap
- A VPS or Cloud with minimum 2 GB RAM
I will be using Contabo for demonstration but you are absolutely free to make your choices. I already have demonstrated steps to get a domain name and VPS in the following video.
Updating DNS records
First thing first make changes to DNS records. Login to your domain registrar and create A record for
After that create or update MX record pointing to
mail.inlearn.in with priority 10.
Then create TXT record for SPF entry and all following in value
v=spf1 mx ~all
First of all, we need a way to connect to the server. Though it’s simple on Linux or MacOS, for Windows you will need an SSH client like putty or Bitvise. Download it and connect to your server
Switch to root user
Set the hostname or Fully Qualified Domain Name (FQDN) with the following command on Ubuntu
hostnamectl set-hostname mail.inguide.in
Don’t forget to replace inguide.in with your domain name.
Then open hosts with the following command
apt install vim -y vim /etc/hosts
Now add the following lines and don’t forget to replace the domain name and IP
45.354.212.212 mail.inguide.in mail
Let’s update the OS.
apt update -y apt upgrade -y
Next install gzip package
apt install gzip
Our initial setup is complete now.
Here the first step would be to get the iRedMail. Go to iRedMail website and download the installer.
Now connect to your server with any FTP client, let’s say WinSCP or FileZilla and upload the iRedMail installer. Or, alternatively download with following command
Next, extract it and begin the installation with the following command
ls tar zxvf 1.4.2.tar.gz ls cd iRedMail-1.4.2 ls bash iRedMail.sh
Answer the series of questions appearing on your screen to finalize the iRedMail installation.
Select email directory location
Select webserver type, if you don’t want to run any applications on this server you can skip it.
Select database type. If you want to run mail only server use OpenLDAP but if you are planning to host application as well then select MariaDB or PostgreSQL.
The following screen pops up only if you select OpenLDAP.
Now type the MySQL administrator password
Finally, enter the domain name here
Now you will be asked to enter postmaster password
Here on this final screen, you have the option to install Webmail, Calendar, Address book & Activesync. Do not select SOGo unless your system has at least 8 GB of RAM. Make your selection then hit next.
Finally the summary of all your choices. If you want to make any modifications press
CTRL+C to stop the installation and start once again. Otherwise, type
Y and continue.
At the end of installation, you will be asked to change the SSH port (port 22) or continue
Now the installation has been finished. Reboot the system to enable all mail services.
Also, copy the different URLs generated for your application.
To open webmail go to https://mail.inlearn.in/mail
To open the admin panel go to https://mail.inlearn.in/iredadmin
Login with your username and password
Now here you can add domains, create users, etc.
Copying DKIM record to the DNS
To get the DKIM record go to the terminal and run the following command.
The output would be something like this
dkim._domainkey.mydomain.com. 3600 TXT ( "v=DKIM1; p=" "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYArsr2BKbdhv9efugByf7LhaK" "txFUt0ec5+1dWmcDv0WH0qZLFK711sibNN5LutvnaiuH+w3Kr8Ylbw8gq2j0UBok" "FcMycUvOBd7nsYn/TUrOua3Nns+qKSJBy88IWSh2zHaGbjRYujyWSTjlPELJ0H+5" "EV711qseo/omquskkwIDAQAB")
Copy the output of command inside ( ) in one line and remove all quotes.
v=DKIM1; p= MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYArsr2...................
After these steps secure your iRedMail server to deal with SSL warnings.
Installing iRedMail is easy and quick. It is loaded with several features and you have options to make a selection of features you like to install. It is a very robust system and it can easily handle a good amount of traffic.