Menu
InformatiWeb Pro
  • Index
  • System admin
  • Virtualization

Login

Registration Password lost ?
FR
  • Windows Server
    • WMS 2012
    • WS2012 R2
    • WS2016
  • Citrix
    • Citrix NetScaler Gateway
    • Citrix XenApp / XenDesktop
    • Citrix XenServer
  • VMware
    • VMware vSphere
    • VMware Workstation
  • Microsoft
    • Hyper-V
  • InformatiWeb Pro
  • System admin
  • Linux
  • Install and secure a complete mail server (Mail, SMTP, Auth by SASL, IMAP, POP3, webmail, TLS and SSL) on Debian

Install and secure a complete mail server (Mail, SMTP, Auth by SASL, IMAP, POP3, webmail, TLS and SSL) on Debian

  • Linux
  • 25 February 2015 at 15:52 UTC
  • InformatiWeb
  • 2/5
Previous page

6. Install POP3 and IMAP protocols (Courier)

Now that the mail server "Postfix" is installed, we will install the access protocols to your E- Mails :
- POP3 : courier-pop
- IMAP : courier-imap

As we store our e-mail addresses in a MySQL database, we will install also "courier-authlib-mysql" and "courier-authdaemon" (for authentication).

Bash

apt-get install courier-base courier-authdaemon courier-authlib-mysql courier-imap courier-pop

When "courier-base" will ask the question "Should we create the necessary directories for the web administration ?", Answer "No".

Once the installation is complete, go to the "/etc/courier" folder.

Bash

cd /etc/courier

Then, edit the "authdaemonrc" file to configure the authentication module on authmysql.

Bash

vi authdaemonrc

Locate the line authmodulelist="authpam" and change the value to "authmysql."

Plain Text

authmodulelist="authmysql"

Then, edit the "authmysqlrc" file to configure the information of connection to MySQL server and the "mapping" of mail server data.

Bash

vi authmysqlrc

In this file, change the following information :

Plain Text

MYSQL_SERVER	localhost
MYSQL_USERNAME	postfix
MYSQL_PASSWORD	his_password
...
MYSQL_DATABASE	postfix
...
# Table containing users
MYSQL_USER_TABLE	mailbox
...
# Field containing the encrypted password of a user
MYSQL_CRYPT_PWFIELD     password
...
# postfix User ID (on Linux)
MYSQL_UID_FIELD         4000
...
# postfix Group ID (on Linux)
MYSQL_GID_FIELD         4000
...
# Field containing the username (or email address) of a user
MYSQL_LOGIN_FIELD       username
...
# Folder of all emails
MYSQL_HOME_FIELD        "/var/spool/vmail"
...
# Name (and firstname) of the user. (the full name specified using Postfix Admin)
MYSQL_NAME_FIELD        name
...
# Indicates where the requested user emails found.
# WARNING : This line is commented out by default. Therefore, you must remove the # at the start of this line to activate it.
MYSQL_MAILDIR_FIELD	maildir

Once you have set up this file, restart mail services (authentication, POP3 and IMAP).

Bash

service courier-authdaemon restart
service courier-pop restart
service courier-imap restart

And finally, check in the logs if no error is displayed.

Bash

cat /var/log/syslog

7. Fix : IMAP Error

If you try to connect to your mail server imap, it's possible that an error is displayed.
This error is : "Filesystem notification initialization error - Contact your email administrator (check for configuration errors with the FAM / Gamin library)

To solve the problem, install the package "gamin" who has the same functionality as "libfam0".
Note : Installing this package will automatically uninstall the package "libfam0" which caused a problem. Apparently, this error occurs with any IMAP client.

Bash

apt-get install gamin

Bash

The following extra packages will be installed :
libgamin0
The following packages will be REMOVED :
libfam0
The following NEW packages will be installed :
gamin libgamin0

Once the package installed, restart the "courier" IMAP service.

Bash

service courier-imap restart

 

8. Advice : POP3 protocol

By default, POP3 downloads emails WITHOUT leave emails on the server. Which is a problem, because, when you log through Webmail (RoundCube in this case), you will no longer have your emails.
To work around this problem :
- Use the protocol "imap" if it's available (in our case : yes)
- Or use the protocol "pop3" but say to the email client, don't delete messages from the server.

In Outlook, go to "Tools -> Account Settings ...". Select your email account and click "Edit". Click the "More Settings" button and go to the "Advanced" tab.
In this tab, check "Leave a copy of messages on the server".

Nevertheless, it's recommended to set this option when you add your e-mail account in your email client. Otherwise, messages have been deleted from the server at the first synchronization.
For this, use the manual method of your e-mail client when you want to use the POP3 protocol to retrieve e-mails.

Next page

Share this tutorial

Partager
Tweet

To see also

  • Install and use the LVM on Linux

    Linux 10/2/2016

    Install and use the LVM on Linux

  • Partition your hard drive with fdisk

    Linux 9/18/2016

    Partition your hard drive with fdisk

  • Ubuntu - Configure a LDAP server and a web interface to manage it

    Linux 1/15/2014

    Ubuntu - Configure a LDAP server and a web interface to manage it

  • Ubuntu - Install a complete web server

    Linux 1/31/2014

    Ubuntu - Install a complete web server

Comments

No comment

Share your opinion

Pinned content

  • Software (System admin)
  • Linux softwares
  • Our programs
  • Terms and conditions
  • Share your opinion

Contact

  • Guest book
  • Technical support
  • Contact

® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.

Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.