Archiving Emails from a Qmail Based Email Server

Revision as of 02:05, 18 June 2010 by Vivian (talk | contribs)

Please note: This tutorial only covers the specifics of archiving an email server based on the mail transfer agent Qmail. It is assumed that you already have a MailStore Server installation or test installation and are familiar with the fundamentals of MailStore Server. Please refer to the Manual or Quick-Start-Guide.

MailStore Server offers several ways to archive emails from an email server, which are described below. If you are not sure which archiving method best suits your company, please refer to chapter Choosing the right archiving strategy.

Archiving Individual Mailboxes

Mail transfer agents such as Qmail are only responsible for transporting emails and, when acting as mail delivery agent, for the delivery to local mailboxes. For accessing the emails in the mailboxes with MailStore, an IMAP- or POP3 service (called mail retrieval agent) has to be installed and started on the email server. If access to the email server via the IMAP and/or POP3 protocol is possible, please refer to the corresponding chapter Archiving Server Mailboxes in the MailStore Server manual to set up the archiving process.

Archiving Multiple Mailboxes in One Step

Mail transfer agents such as Qmail are only responsible for transporting emails and, when acting as mail delivery agent, for the delivery to local mailboxes. For accessing the emails in the mailboxes with MailStore, an IMAP- or POP3 service (called mail retrieval agent) has to be installed and started on the email server. If access to the email server via the IMAP protocol is possible, please refer to the corresponding chapter Batch Archiving of IMAP Mailboxes in the MailStore Server manual to set up the archiving process.


Archiving Incoming and Outgoing Emails Directly

Qmail has the ability to set up a mailbox where all emails that Qmail handles get copied to. Here is an adapted version of the appropriate "Life with Qmail FAQ" article

Step 1: Edit extra.h

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. E.g., 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

Step 2: Recompile Qmail

Shut down qmail if it's running. If you installed the qmailctl script from the Installation section, that can be done by:

 qmailctl stop

If you don't have the qmailctl script, you should use your startup/shutdown script or send qmail-send a TERM signal.

Then rebuild qmail using:

 make setup check

Step 3: Prepare mailstore user

Populate ~alias/.qmail-mailstore with:

 /var/mailstore/Maildir/

Finally, restart qmail.

Weblinks