smtp-server-iredmail

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.

About iRedMail

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.

Requirement

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

Initial Setup

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

sudo -i

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.

Installing iRedMail

Here first step would be to get the iRedMail. Go to iRedMail website and download installer.

download-iredmail

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

wget https://github.com/iredmail/iRedMail/archive/1.4.0.tar.gz

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

iredmail-select-email-directory-location

Select webserver type, if you don’t want to run any applications on this server you can skip it.

select-webserver

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.

Specify LDAP suffix

Now type the MySQL administrator password

Finally enter the domain name here

enter-the-domain-name

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.

amavisd-new showkeys

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.

Conclusion

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.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *