eliminate-dups [options] [dbname]

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


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.


The following command-line options are supported:


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


Print a usage message and exit


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.


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.


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.


Create a ~/.qmail-maildir file


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

  | eliminate-dups hashfile

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

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


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.