Mail access: Dovecot


by ross at 05:20:17 on February 26, 2012


# cd /usr/ports/mail/dovecot2
# make install clean
# rehash

Create /usr/local/etc/pam.d/dovecot:

auth    required nullok
account required

Copy configuration samples:

# cp -r /usr/local/share/doc/dovecot/example-config/* /usr/local/etc/dovecot/

Auth machanisms

Edit conf.d/10-auth.conf, set

# Optionaly:
disable_plaintext_auth = no

# Mechanisms:
auth_mechanisms = plain login


If you don't need SSL then uncomment and set to "no" keyword ssl in conf.d/10-ssl.conf and also comment out ssl_cert and ssl_key lines.

If you do need SSL then first create the certificate as described here. Uncomment and set the following (conf.d/10-ssl.conf):

ssl_cert = </etc/certs/
ssl_key = </etc/certs/

Option 1. Maildir accounts

In order to use Maildir accounts edit conf.d/10-mail.conf:

mail_location = maildir:~/Maildir
maildir_copy_with_hardlinks = yes

Option 2. mbox accounts

Allow access to /var/mail (conf.d/10-mail.conf):

mail_privileged_group = mail

Set mail location (conf.d/10-mail.conf):

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

If your users are homeless then ~/mail/ wont work. In this case:

# mkdir /var/spool/mail
# chmod 777 /var/spool/mail
mail_location = mbox:/var/spool/mail/%u:INBOX=/var/mail/%u

Add to /etc/rc.conf:


Start Dovecot:

# service dovecot start