Archiving Emails from Linux-based Email Servers

Revision as of 18:13, 25 June 2014 by Dweuthen (talk | contribs)

Synchronizing Users

Linux-based email servers support various database types for managing users. Additionally to the legacy user database know as the passwd file, LDAP-based databases such as OpenLDAP or Active Directory as well as SQL-based databases are often used. Instruction on setting up user synchronization with MailStore Server can be found in the following chapters of the MailStore Server manual:

Note: When batch-archiving IMAP mailboxes MailStore Server automatically creates non-existing users. The authentication type of those users will be set to MailStore-integrated.

Archiving Individual Mailboxes

Template:Archiving Single Mailbox Preamble Preamble

Template:Archiving Archive Single Mailbox

Archiving Multiple Mailboxes in One Step

Configuration of the IMAP Server

Dovecot IMAP

TODO

Cyrus IMAP

TODO

Configuration of MailStore Server

Archiving Incoming and Outgoing Emails Directly

Configuration of the Mail Transfer Agent

Exim

First create a new mailbox that should act as a multidrop mailbox.

To deliver copies of all emails into a multidrop mailbox, it is necessary to add a new router as well as a new transport to the Exim configuration.

The configuration of the new Exim router should look like this:

mailstore_router:
  no_expn
  no_verify
  transport = mailstore_transport
  driver = accept
  unseen

Please make sure that the mailstore_router is passed through before the router responsible for delivering the messages to the actual user mailboxes. It is strongly recommended to enter it first in the Exim router configuration. Depending on your anti-spam or anti-virus protection it may also be suitable to put it right after the routers handling those actions.

The delivery into a multidrop mailbox is performed by the corresponding Exim transport, which is to be defined in the transport section of the Exim configuration. In this example, a transport called mailstore_transport is to be created. A new transport can be put anywhere in the Exim transport configuration. The following example shows the configuration of an Exim transport storing all emails in Maildir format in the directory /var/mailstore/Maildir. To store messages in a different location, please refer to the Exim manual.

mailstore_transport:
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add
  maildir_format = true
  create_directory = true
  directory = /var/mailstore/Maildir

After making these configuration changes, the Exim daemon must be restarted.

Postfix

First create a new mailbox that should act as a multidrop mailbox.

To have Postfix send a copy of all emails to this mailbox, you need to add the following line to the file main.cf:

 always_bcc = [email protected]

Sendmail

Because Sendmail is one of the most flexible mail transfer agent available, there is no best practice guide for setting up the functionality described above. How Sendmail is configured to send a copy of all emails to an additional mailbox mainly depends on your system environment. Since Sendmail 8.10 it is recommended to use the libmilter interface to add features to Sendmail.

A database with all available Milter plug-ins is available at https://www.milter.org. There is also a special section with archiving solutions. The listed plug-ins differ substantially in the way they are integrated into Sendmail and the way they work.

Qmail

First create a new mailbox that should act as a multidrop mailbox.

To have Postfix send a copy of all emails to this mailbox certain changes to be made before compiling the Qmail source code. The following guide is an adapted version of the article "Life with Qmail FAQ":

QUEUE_EXTRA is a compile-time configuration variable that specifies an additional recipient that will be added to every delivery. This is used primarily for logging; the FAQ describes how to use QUEUE_EXTRA to keep copies of all incoming and outgoing messages.

To use QUEUE_EXTRA, edit extra.h specifying the additional recipient in the format Trecipient\0, and the length of the QUEUE_EXTRA string in QUEUE_EXTRALEN (the "\0" counts as one character). For example:

 #define QUEUE_EXTRA "Tmailstore\0"
 #define QUEUE_EXTRALEN 11

Recompile the Qmail source code an restart the Qmail daemon to apply the changed.

Detailed information regarding Qmail can be found on the [Qmail Hompage] and [Life with qmail].

Configuration of MailStore Server

Template:Archiving Archive Multidrop Mailbox