The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

eliminate-dups

SYNOPSIS

  eliminate-dups [options] [dbname]

If dbname is not specified, it defaults to $HOME/.maildups.

DESCRIPTION

Reads an email message on standard input and calculates a fingerprint based on the mail headers. If the fingerprint already exists in the hash file, then the message is a duplicate. If the fingerprint does not exist, save the fingerprint in the hash file and deliver the message.

OPTIONS

The following command-line options are supported:

--dump

Dump the fingerprint DB human-readably and exit. Implies --no-check and --no-purge.

--help

Print a usage message and exit

--no-check

Do not compute any message fingerprints (i.e., only purge). The same exit status will be returned as if a fingerprint check found no match--i.e., any message on standard input will not be flagged as a duplicate.

--no-purge

Do not purge the fingerprint DB (i.e., only check). This option can be used to reduce load on the mail server. The script should periodically be run with the --no-check option to keep the fingerprint database from growing without limit.

--strict

Include the message body when calculating fingerprints.

Contradictory options are silently accepted. For example, --no-check is inconsistent with --strict, but no error is reported if both are used. Similarly, --no-check and --no-purge together mean that the script does nothing (unless --dump or --help is also specified), but this doesn't result in an error.

SETUP

Create a ~/.qmail-maildir file

   ./Maildir/

Then add the following lines to your ~/.qmail file

  | eliminate-dups hashfile
  &user-maildir

Forwarding to the user-maildir address is very important. It ensures that if delivery to the Maildir is deferred, eliminate-dups will not be called a second time (which would result in a lost message).

To reduce server load, the following can be used in the ~/.qmail file instead:

  | eliminate-dups --no-purge hashfile
  &user-maildir

If the --no-purge option is used, then a cron job must be set up to purge the fingerprint database periodically. The following can be put in the user's crontab file:

  23 2 * * *       /path/to/eliminate-dups --no-check $HOME/.maildups

LICENSE

Copyright (C) 2007-2008 Len Budney

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.