Open source mail server – set up Rainloop open source mail server

Open source mail server - How to set up Rainloop open source mail server
Open source mail server - How to set up Rainloop open source mail server

 Open source mail server

Open source mail server the topic that we are going to discuss about. I will show you how to set up  open source mail server Rainloop in your Linux System. The local mail server here means you will be able to send and receive mails within the private network but not outside of the network.

Local open source mail server can be beneficial in many ways. You can set the alert to send mail directly to your local mail.
You can mail anyone within the network by the local mail.

The protocols that are used to set up an open source mail server in Linux or Unix are.

  • SMTP - Simple Mail Transfer Protocol
  • POP3 - Post Office Protocol
  • IMAP - Internet Message Access Protocol

Note: SMTP is used for transferring mails, POP3 and IMAP are used to access and receive  mails. The two packages that we need here to set up a mail server are the followings


Note: POSTFIX supports SMTP, Dovecot supports both POP3 and IMAP.

Necessary Port Numbers for Mail server

  • SMTP--25
  • SMTPS(smtp with SSL)--465
  • IMAP--143
  • IMAP with SSL/TLS--993
  • POP--110
  • POP with SSL/TLS--995

By default if you have a sendmail application installed on your Linux system, you just need to remove it, because it can create trouble while you set up mail server with POSTFIX and DOVECOT. So, it's better to remove it. Go to the terminal and type the following command to remove send mail.

# yum remove sendmail  

Set up the local domain name(DNS) with your private IP

As this a set up for the local mail server, so you don't need a public IP right now. You need the static private IP of your Linux computer. To check what is your private IP type the following command on the terminal. # ifconfig Now you know the IP address. Open the "hosts" file and configure it as given below. Run the below command on the terminal and edit the hosts file. I have added here my computer static IP address  and the hosts name of my computerin the hosts file.

# vi /etc/hosts
Open source mail server
Open source mail server







Install and configure POSTFIX

# yum install postfix

Now edit the postfix configuration file ""

# vi /etc/postfix/

Edit and add the following lines inside the "" file.

Line 77: Uncomment add the host name to myhostname.

myhostname = server.techsakh.local

Line 83:  Uncomment and add the domain to mydomain.

mydomain = techsakh.local

Line 99: Uncomment the line.

myorigin = $mydomain

Line 113: Uncomment and set inet_interfaces to all.

inet_interfaces = all

Line 119: Set inet_protocols to all.

inet_protocols = all

Line 164: Comment the line.

#mydestination = $myhostname, localhost.$mydomain, localhost

Line 165: Uncomment it.

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

Line 264: Add the IP.

mynetworks =,

Line 419: Uncomment it.

home_mailbox = Maildir/  


Now save the file with  :wq  



Install and configure DOVECOT

  At first install dovecot by the following command.

# yum install dovecot  

When the installation is done edit the dovecot configuration file.

# vi /etc/dovecot/dovecot.conf

Line 24: Uncomment the line

protocols = imap pop3 lmtp  

Now edit the 10-mail.conf file of dovecot.

# vi /etc/dovecot/conf.d/10-mail.conf  

Line 24: Uncomment the line mail_location = maildir:~/Maildir  

Edit 10-master.conf file.

vi /etc/dovecot/conf.d/10-master.conf  

Line 91 and 92: Uncomment the line and edit as give below.

user = postfix group = postfix

 Edit 10-auth.conf file

# vi /etc/dovecot/conf.d/10-auth.conf

Line 10: Uncomment it.

disable_plaintext_auth = yes  

Line 100: Uncomment the line.

auth_mechanisms = plain login  


Restart the server

# systemctl restart postfix
# systemctl restart dovecot

Allow port 80 through firewall

# firewall-cmd  --permanent  --add-port=80/tcp



 Now as the Postfix and Dovecot is installed and configured you need to test if its working?
At first test the status of SELINUX. The full form of SELINUX is Security Enhanced Linux. As the name suggest it is a security enhancement in Linux. You can define rules for the access control in SELINUX. To check the proper testing of POSTFIX and DOVECOT you have to disable SELINUX. Type the following command to display the status of SELINUX.

# getenforce

If the out put of the above command is "Disabled" then its OK, otherwise you have to edit the configuration file. To configure the SELINUX open the file in the vi editor.

# vi /etc/sysconfig/selinux

change SELINUX = disabled

Open source mail server
Open source mail server


Add a new user for your local mail server.

# useradd techsakh

Now add a password for techsakh

# passwd techsakh


Test Postfix

Postfix uses the protocol smtp to transfer the mail. So we will test if we able to send the local mail by smtp.

# telnet localhost smtp

Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 server1.unixmen.local ESMTP Postfix
ehlo localhost                                [Type this line]
250-SIZE 10240000
250 DSN mail from:<techsakh>        [Type this line, this is sender address]
250 2.1.0 Ok
rcpt to:<rocky>                                                [This is sender receiver address]
250 2.1.5 Ok
data                                                                           [Type this line]
354 End data with <CR><LF>.<CR><LF>
This is testing time                        [ Body of your mail]
.                                                       [Put a dot (.) in this line]
.250 2.0.0 Ok:  queued as 441C2A36A8
quit                                              [Type this line to quit]
221 2.0.0 Bye
Connection closed by foreign host.

  Postfix is working absolutely fine.


Test Dovecot

Dovecot uses the POP3 protocol to receive mails. You need to test here POP3 is working or not?

# telnet localhost pop3

Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user rocky                        [Write the user name]
pass 1234                         [Write the password]
+OK Logged in.
retr 1                                 [Write this line]
+OK 417 octets
Return-Path: <techsakh@techsakh.local>
X-Original-To: rocky
Delivered-To: rocky@techsakh.local
Received: from localhost (localhost [IPv6:::1])
by server.techsakh.local (Postfix) with ESMTP id 0451CA34C8
for <rocky>; Wed,  6 Jan 2016 01:44:12 +0530 (IST) Message-Id: <20160105201454.0451CA34C8@server.techsakh.local>
Date: Wed,  6 Jan 2016 01:44:12 +0530 (IST)
From: techsakh@techsakh.local
This is testing time .
quit                                  [Write this line to log out]
+OK Logging out.
Connection closed by foreign host.


Dovecot is also working fine.  


Install and configure RAINLOOP

Rainloop is a an open source web based mail application. It supports SMTP to transfer mails and IMAP to receive mail. Unfortunately POP3 is not supported in Rainloop right now.


How to download and install webmail open source application Rainloop

--Download repository--

# curl -O

--Create a directory "rainloop" under html directory--

# mkdir /var/www/html/rainloop
--Unzip rainloop zip file in rainloop directory--
# unzip -d /var/www/html/rainloop
--Change mode and change the ownership--
# find /var/www/html/rainloop -type d -exec chmod 755 {} \;
# find /var/www/html/rainloop -type f -exec chmod 644 {} \;
# chown -R apache. /var/www/html/rainloop

How to configure webmail open source application Rainloop

Now as everything is set, restart network and apache by the following command.
# systemctl restart network
# systemctl restart httpd


 Create database

You need to create a database to enable contacts in Rainloop. Lets create a database first.

# mysql -u  root  -p

mysql>  create database rainloop;
mysql>  exit

Also check out this article Mysql import sql file Linux - how to

Connect admin panel of rainloop

To configure Rainloop you have to go to the admin panel of rainloop. Type in your URL. The default user name is "admin" and password is "12345" to login into the admin panle of rainloop.
Open source mail server
Open source mail server with Rainloop
 Now to change the  password, go to Security option and change the admin panel default password.
Open source mail server
Open source mail server
Configure Rainloop. Add your local domain to Rainloop. Give the server IP address and port number as given below in the image. Check Use short login  and Use authentication.
Open source mail server
Open source mail server with Rainloop
 Now go to contacts, check Enable contacts and Allow contacts sync. Select storage type as MySQL.
Give your root password.
Open source mail server
Open source mail server with Rainloop
Configuring the Admin panel is all done. Now you can login to your user panel by providing the login credentials.
Connect user panel
For user login Type the URL  and provide the login credentials. Login compose and  send the local mail to the recipient  Give the recipient mail id as  username@domain name 
For example: techsakh@techsakh.local
Open source mail server
Open source mail server with Rainloop


Image credit: Linux Screenshots

 That's all with the tutorial Open source mail server - How to set up Rainloop open source mail server

Download Our Free eBook now

Linux and UNIX Shell scripting ebook

Be the first to comment

Leave a Reply

Your email address will not be published.