On the previous article we have seen how to configure postfix configuration for a mail server. In this second part we will be seeing how to configure and integrate dovecot to handle mail box.

    Dovecot is an open-source Internet Message Access Protocol (IMAP) and Post Office Protocol version 3 (POP3) server application. It retrieves emails from Postfix and delivers them to the relevant mailbox on the mail server.

    The main config file is /etc/dovecot/dovecot.conf, all other related files are included in the main config file.

To integrate IMAP with postfix we have already declared the parameters on /etc/postfix/main.cf files on the Part-I article,

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

Changes to be updated on dovecot.conf file:

    Uncomment the protocol for accepting connections from external world,

$ vim /etc/dovecot/dovecot.conf

protocols = imap pop3

Changes to be done on authentication process file:

    Disable plaintext autentication on 10-auth.conf file,
   
    Update your authentication mechanisms to accept plain login, this auth_mechanisms parameter specifies the method that the email client uses to authenticate with Dovecot.

$ vim /etc/dovecot/conf.d/10-auth.conf

disable_plaintext_auth = no

auth_mechanisms = plain login

Configuring Mail location:

    The mail location can be configured by editing the /etc/dovecot/conf.d/10-mail.conf file,

$ vim /etc/dovecot/conf.d/10-mail.conf

Edit your mail location to,

mail_location = mbox:~/mail:INBOX=/var/mail/%u

    This will set your mail location to /var/mail/ and respective user directory.

    Comment the namespace declaration for inbox.

#namespace { #inbox = no #}

Enabling additional Mail plugins:

    Add the below declaration inside the imap protocol in /etc/dovecot/conf.d/20-imap.conf that allows to create plugin automatically,

$ vim /etc/dovecot/conf.d/20-imap.conf

protocol imap {

mail_plugins = $mail_plugins autocreate

plugin {
autocreate = Trash
autocreate2 = Junk
autocreate3 = Drafts
autocreate4 = Sent
autosubscribe = Trash
autosubscribe2 = Junk
autosubscribe3 = Drafts
autosubscribe4 = Sent
}

}

All other config files can be left as default.

Restart you imap server to reflect the changes.

    We have successfully configured IMAP server and SMTP server. Now we need an web interface to access our mail server and that can be done using a mail client Rouncube webmail. We will see how to setup Roundcube webmail on the following article Setting up a Mail server using Roundcube - Part-3 - Centos 7.

Feel free to ask if you have any questions.

Comments

  1. Be the first to add a comment.