Getting Mail into Enkive

From Enkive Wiki

Revision as of 17:47, 12 November 2010 by Lee (Talk | contribs)
Jump to: navigation, search

Currently Enkive supports two methods for receiving mail. We support live mail received from a postfix filter, and receiving mail from our import utility which reads maildir format.

Contents

Postfix Filter

Configure Postfix

The Role of the Postfix Enkive Filter

The mechanism by which Postfix gets email into Enkive is through a Postfix filter. The filter is re-executed for every message to be archived. The program receives some basic information as command line arguments and the message text through standard input. It then sends this information into Enkive through a socket using a specialized protocol. This filter is essentially a bridge between Postfix and Enkive.

Because this filter is launched per message, for performance reasons it is written in C rather than Java.

We currently distribute a compiled version of this program enkive-socket-filter for Linux systems. We also supply the source code and a Makefile for those who would like to use (port) it to other platforms. The relevant files can be found within the expanded zip file under:

support/filters/postfix

Setting up the Postfix Enkive Filter

It should be known that this method assumes a copy of the message is received by postfix, as Enkive will consume the message and not send it back for delivery.

Once you have a compiled version of this file, it's time to setup postfix to use it. For a quick setup, place the following code in postfix's master.cf. This snippet assumes you've placed the compiled filter in /opt/enkive-util/. This setup will send every message that comes through the postfix queue to Enkive.

NOTE: Again, Messages that are received by this postfix, get sent to Enkive, but do not get delivered to users.

smtp      inet  n       -       n       -       -      smtpd
        -o content_filter=filter:dummy

filter    unix  -       n       n       -       -      pipe
          flags=Rq user=nobody null_sender=
          argv=/opt/enkive-util/enkive-socket-filter localhost 2527 ${sender} ${recipient}

Import Instructions

We currently provide a nice path to import Mail that's in Maildir format into the Enkive archive on UNIX-like systems. We plan on adding the ability to import from other formats in the near future. We hope to get contributions for other operating systems as well.

Import from MailDir format

From the extracted Enkive tar, you should be able to descend into the following directory:

setup/scripts/import

You will find a Unix shell script named loadMaildir.sh.

You can run it with:

 sh loadMailDir.sh <path-to-maildir-directory>

It requires one command-line argument that is the path to the Maildir directory. It should be a path to a directory that contains a subdirectory named Maildir. It's not the path to this very directory.

You can also supply a number of command-line options that will alter the behavior:

  • -h host : the address of the host on which Enkive is running; default is localhost
  • -p port : the port number which the Enkive Maildir importer is listening; default is 2526
  • -j jarpath : the path to the directory that contains two necessary JAR files -- enkive-util.jar and mail.jar. The default is setup/lib (using a relative path -- ../../../lib).

The script will do some basic error checking:

  • look for the expected JAR files on the jarpath
  • look for a directory named Maildir on the path to the Maildir archive
Personal tools