Dovecot as a POP3 server
========================

Dovecot was primarily designed to be an IMAP server, so although it works fine
as a POP3 server, it's not really optimized for that.

Index files
-----------

If your users don't keep mails in the server, the index files may just make the
performance worse. You may want to disable them completely, or with mboxes use
the 'mbox_min_index_size' setting.

If your users do keep the mail in the server, the messages' virtual sizes are
stored in 'dovecot.index.cache' file. Recalculating the sizes requires reading
and parsing all the user's mails, so if you lose all the POP3 users' index
files, your disk I/O may burst and make your mail server unbearably slow for
hours. With IMAP losing the index files won't have such a drastic slowdown.

Session locking
---------------

By default Dovecot allows multiple POP3 connections to the same mailbox. This
is (was?) especially useful for dialup connections which die in the middle of
the download, because the half-dead connections won't keep the mailbox locked.

Setting 'pop3_lock_session=yes' makes Dovecot lock the mailbox for the whole
session. This is also what the POP3 RFC [http://www.ietf.org/rfc/rfc1939.txt]
specifies that should be done. If another connection comes while the mailbox is
locked, Dovecot waits until the locking times out (2 minutes with
Maildir,'mbox_lock_timeout' with mbox). In future there will be a separate
'pop3_lock_timeout' setting which allows timing out sooner.

Flag changes
------------

By default when a message is RETRed, \Seen flag is added to it. POP3 itself
doesn't support flags, but if the mailbox is opened with IMAP (eg. from
webmail) it's shown as seen. You can disable this (to get better performance)
with 'pop3_no_flag_updates=yes'.

POP3 client workarounds
-----------------------

'pop3_client_workarounds' setting allows you to set some workarounds to avoid
POP3 clients breaking with some broken mails.

UIDL format
-----------

If a POP3 client is configured to keep the mail in the server, it uses the
messages' UIDLs to figure out which messages it has already downloaded. Dovecot
supports multiple different ways to set this UIDL format, mostly to make
migrations from other POP3 servers transparent. If the UIDL format changes, the
client downloads all the messages again, which the users don't really
appreciate. See<Migration.txt> for how to set the UIDLs to be compatible with
your previous POP3 server.

For new POP3 servers, the easiest way to set up UIDLs is to use IMAP's
UIDVALIDITY and UID values. The default for future Dovecot versions will be:

---%<-------------------------------------------------------------------------
pop3_uidl_format = %08Xu%08Xv
---%<-------------------------------------------------------------------------

Some formats, such as the previous default %v.%u, seem to have problems with
Outlook 2003.

MD5 UIDL format
---------------

Note: this works only with mbox format.

If you're using 'pop3_uidl_format = %m' (MD5 sum from a couple of headers), you
may have problems if you receive two identical messages. Usually the MD5 sum is
taken from these headers:

 * The first Received: header
 * Delivered-To: header

Normally there won't be a problem, because the MTA adds a unique identifier to
the first Received: header. If the same message is sent to multiple users in
one delivery, the Delivered-To: header is still different, making the MD5 sum
different.

Except the MTA can be configured to support aliases, so for example sending the
mail to both root@ and webmail@ aliases causes the message to be delivered to
the same user, with identical Received: and Delivered-To: headers. The messages
really are identical, so their MD5 sums are also identical, and that can cause
some POP3 clients to keep downloading the messages over and over again, never
deleting them.

To avoid this, there's also a 3rd header that is included in the MD5 sum
calculation:

 * X-Delivery-ID: header

If you use <Dovecot's deliver> [LDA.txt] or IMAP APPEND and 'pop3_uidl_format =
%m', it always appends the X-Delivery-ID: header to saved mailbox. Any existing
X-Delivery-ID: headers in the saved mails are dropped.

(This file was created from the wiki on 2007-04-13 14:32)
