So, I've been playing with Exim filters as an alternative to
procmail, and they are indeed much nicer. However, I can't find a way
to do the equivalent of formail -D to eliminate duplicate messages.
I've searched Google, the exim-users archive, and all the Exim docs, to
no avail.
Well, here's the solution I came up with. Put this before the
userforward router in the exim4 config:
<snip>
#
# dupclean router
#
# This router checks for a user's $home/.eximidcache file. This is a
# file for lsearch lookups, where the key is a message-id and the value
# is anything nonzero. If the key is found, the message is considered
# a duplicate and discarded.
#
dupclean:
debug_print = "R: Checking message-id $header_message-id: for $local_part@$domain"
driver = redirect
check_local_user
no_verify
no_expn
allow_filter
require_files = $home/.eximidcache
condition = ${lookup{$header_message-id:}lsearch{$home/.eximidcache}}
data = # Exim filter \n\
seen finish # Black hole
no_more
</snip>
The user is then responsible for populating $home/.eximidcache
with "<message-id>: 1" key:value pairs for the lsearch. If the user
doesn't have a .eximidcache, this router isn't even run. But folks like
me can do the following in .forward:
<snip>
logfile $home/.eximidcache
logwrite "$header_message-id:: 1"
</snip>
This saves off the "<message-id>: 1" pair in .eximidcache. This
can, indeed, be changed to a DBM later if one likes. The next time the
message-id is seen by exim, the router matches and the duplicate message is
discarded. Just like formail -D.
Did I miss a more germane solution to this problem? Please let
me know.
Joel
--
"Ninety feet between bases is perhaps as close as man has ever come
to perfection."
- Red Smith
http://www.jlbec.org/
jlbec@???