Building SMTP server with iReadMail 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 database type.
Perhaps iRedMail is the only mail server solution that can be installed on all version of Linux. So, here also you have 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 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 mail.inguide.guru.
After that create or update MX record pointing to mail.inguide.guru 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 a 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 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 following command
apt install vim -y vim /etc/hosts
Now add following lines and don’t forget to replace 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 first step would be to get the iRedMail. Go to iRedMail website and download 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 following command
ls tar zxvf 1.4.0.tar.gz ls cd iRedMail-1.4.0 ls bash iRedMail.sh
Answer the series of questions appearing on your screen to finalize 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 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 modification 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 SSH port (port 22) or continue
Now installation has been finished. Reboot the system to enable all mail service.
Also, copy the different URLs generated for your application.
To open webmail go to https://mx.inguide.guru/mail
To open admin panel go to https://mx.inguide.guru/iredadmin
Login with you username and password
Now here you can add domain, create users etc.
Copying DKIM record to the DNS
To get the DKIM record go to the terminal and run the following command.
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 warning.
Installing iRedMail is easy and quick. It is loaded with several features and you have options to make selection of features you like to install. It is very robust system and it can easily handle good amount of traffic.