Debian Tutorials

Debian Tutorials


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

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories


Installing Courier POP3 and IMAP daemon with MySql backend

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

The Courier mail transfer agent (MTA) is an integrated mail/groupware server based on open commodity protocols, such as ESMTP, IMAP, POP3, LDAP, SSL, and HTTP. Courier provides ESMTP, IMAP, POP3, webmail, and mailing list services within a single, consistent, framework. In this tutorial we’ll only use the Courier POP3 and IMAP services.

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 courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl

2. Make Courier use MySql backend (pico /etc/courier/authdaemonrc)

authmodulelist="authmysql"

3. Configure the MySql connector (pico /etc/courier/authmysqlrc)

MYSQL_SERVER 127.0.0.1
MYSQL_USERNAME {username}
MYSQL_PASSWORD {password}
MYSQL_PORT 0
MYSQL_DATABASE {database}
MYSQL_USER_TABLE users
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD 5000
MYSQL_GID_FIELD 5000
MYSQL_LOGIN_FIELD email
MYSQL_HOME_FIELD "/home/vmail"
MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
MYSQL_QUOTA_FIELD quota

{database} = MySql database name
MySql username
MySql password

4. Restart Courier daemons

/etc/init.d/courier-authdaemon restart
/etc/init.d/courier-imap restart
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop restart
/etc/init.d/courier-pop-ssl restart

Comments 3
  • Dave
    Posted on

    Dave Dave

    Author

    Although I doubt anyone will get mixed up on it, shouldn’t the end of step 3 be the following?:
    {database} = MySql database name
    {username} = MySql username
    {password} = MySql password

    Besides that, thanks for all the articles!


  • Dave
    Posted on

    Dave Dave

    Author

    I will also note that I could not auth due to the column ‘name’ missing from the ‘users’ table. I just added it in there to get it to work. Not sure if I did it correctly, but it works. 🙂


  • jonhson
    Posted on

    jonhson jonhson

    Author

    Hi,

    i got this error log :
    Feb 21 04:22:03 smtp postfix/virtual[18952]: warning: mysql query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(email,’@’,1),’/’) FROM users WHERE email=’[email protected]” at line 1

    need a help