How to Configure Postfix & Dovecot With Roundcube (Part 1)

Learn about How to configure postfix and dovecot with Roundcube in centos 7 VPS in the 1st part of the article.

Mail Server

Popularly also known as ‘email server’ that help to send and receive mail from client to server, fully managed VPS server to different servers by using different protocols like SMTP(Simple Mail Transfer Protocol) that is used to send emails and POP3 or IMAP that is used to receive emails.

In this configuration we use Postfix as an SMTP protocol for sending mail and Dovecot as an IMAP or POP3 for receiving mail on email client from the server, also use round cube for web-based IMAP client.


1. Centos 7 VPS

2.Domain Name

3. Postfix


5. Roundcube

Configure Centos 7 VPS

In Centos 7 VPS, enable SSH and HTTP port.

After that open machine with SSH in the local system and Disabled the Se Linux by using the following command:

# vi /etc/selinux/config

In place of SELINUX =Enforcing replace Enforcing with Disabled and save the configuration file with :wq.

Configure Domain Name

Configure your domain name by creating new MX record in the management console of your domain name, also create A record with the Name ‘mail’ in the same domain.

You can configure it by using the following steps:
1. Open your Domain Name provider website and login with your own credentials.

2.Go inside your Domain Name and click on manage DNS, now after that give IP address of your Linux vps hosting in Target field.

3. Now Create two records one is the A record by filing the following fields like:

Name Type TTL Target

WWW A 300 IP_Address

MAIL A 300 IP_Address
4. After creating A record now create MX record by filling the following fields like:

5.Name Type TTL Target

MX 3600

Save the configuration and exit from the settings.

Configure Postfix

Postfix is allowing server to send mail to email client and server by using SMTP protocol.

Install Postfix

First install postfix by using yum command:

# yum -y install postfix

Edit the configuration file /etc/postfix/ and set the value as follows:

# vi /etc/postfix/ (Open File with the vi editor)

myhostname = (Enter your

mydomain = (Enter

myorigin = $mydomain

inet_interfaces = all

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

mynetworks =, (Enter your own system IP address) not compulsory

home_mailbox = Maildir/

Uncomment ‘#’ from the above lines.

Once all the value has been set, after that set application to start during system boot and start the service by using the following command:

# chkconfig postfix on

# service postfix start

Testing Postfix

To check if everything is working properly or not, you can send an email by type the following command from console:

# telnet localhost smtp

If telnet command not work then first download telnet with the following command:

# yum -y install telnet

Before testing postfix create new user with help of following command:

# useradd admin

# passwd admin

Give New password and confirm password.

After then give several inputs to send mail:
→ ehlo localhost

→ mail from:

→ rcpt to:

→ data

→ New Mail!

→ .

→ quit

To check if the mail has been received or not, go inside the following directory i.e. /home/username/Maildir/new/

# cd /home/admin/Maildir/new/

# ll

# cat Name)

If the mail received by the system then mail server is working properly.

Configure Dovecot

While Postfix acts as a Mail Transfer Agent(MTA)only, in order to retrieve emails using modern tools you need to enable IMAP/POP3 protocols. Dovecot is an application that acts as a secure IMAP and POP3 server.

Install Dovecot

By using yum command you can install Dovecot:

# yum install dovecot

Edit the configuration file /etc/dovecot/dovecot.conf to enable the needed protocols.

# vi /etc/dovecot/dovecot.conf

Uncomment ‘#’ from the following lines in this file:

→ protocols = imap pop3 lmtp

Then you need to specify the mail location by editing the file /etc/dovecot/conf.d/10-mail.conf.

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

→ mail_location = maildir:~/Maildir

Edit the file /etc/dovecot/conf.d/10-auth.conf and set the following values:

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

→ disable_plaintext_auth = no

→ auth_mechanisms = plain login

Last file to edit /etc/dovecot/conf.d/10-master.conf.

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

unix_listener auth-userdb {

#mode = 0600

user = postfix

group = postfix


Note: After done editing in each file save with :wq in vi editor.

Also set Dovecot to start at system boot and start the service.

# chkconfig dovecot on

# service dovecot start

Testing Dovecot

To check if everything is working properly or not, you can receive an email by type the following command from console:

# telnet localhost pop3

After that give several input to retrieve mails.

→ user admin (use your_user_name)

→ pass password (use your_password)

→ list

→ retr 1

Now message is shown here and after checking the output quit the screen with:

→ quit


Learn how to scale, manage, and optimize your applications with a SLB. Read our solution brief "Get More from Your Enterprise Network".


Get started with CloudMinister Today