Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories


Installing Dovecot IMAP and POP3 daemon with MySql backend on squeeze

Ástþór IPÁstþór IP

Dovecot is an open source IMAP and POP3 server for Linux/UNIX-like systems, written primarily with security in mind. Dovecot primarily aims to be a lightweight, fast and easy to set up open source mailserver.

It’s assumed that you have already installed and configured Postfix according to this tutorial:
Installing Postfix with MySql backend and SASL for SMTP authentication

1. Install required packages

apt-get install dovecot-imapd dovecot-pop3d

2. Configure Dovecot (pico /etc/dovecot/dovecot.conf)

mail_location = maildir:/home/vmail/%d/%n
auth default {
passdb sql {
args = /etc/dovecot/dovecot-sql.conf
}
userdb sql {
args = /etc/dovecot/dovecot-sql.conf
}
}
disable_plaintext_auth = no
user = vmail

Add or edit the above properties and leave everything else with the default value or configure according to your needs

3. Configure the MySql connector (pico /etc/dovecot/dovecot-sql.conf)

driver = mysql
connect = host=127.0.0.1 dbname={database} user={username} password={password}
default_pass_scheme = CRYPT
password_query = SELECT email as user, password FROM users WHERE email = '%u'
user_query = SELECT CONCAT('/home/vmail/',SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') as home, '5000' as uid, '5000' as gid FROM users WHERE email = '%u'

{database} = MySql database name
{username} = MySql username
{password} = MySql password

4. Restart Dovecot daemon

/etc/init.d/dovecot restart

Comments 0
There are currently no comments.