procmail
[Top] [All Lists]

Re: Dup check, no dumping of message?

1999-10-31 13:48:20
Rejo Zenter wrote,

| With all the examples i have seen, as well as all the rcipes i have seen
| in the archives, all checks for duplicate Message-ID's will dump a
| message if the messages has a Message-ID that has been seen before.
| 
| What i would like to have is formail to add an extra headerfield instead
| of dropping a message. Will this work?
| 
|   :0Whc: msgid.lock
|   $FORMAIL -D 8192 msgid.cache
|   [action for adding extra header]

No.  It will try to append every message to the formail binary and give you a
bunch of syntax errors.

To alter the text of the current message and go on processing more recipes,
you use the `f' flag (filter).  The `c' flag (copy) is for delivering a copy
of the message to that recipe's action and going on reading more recipes to
deliver the original.

Local lockfiles are designed for delivery, not for checking conditions, so to
put a lock on testing a condition you need to use the lockfile(1) binary that
comes with procmail or the LOCKFILE variable:

 LOCKFILE=msgid.lock
 :0hwf
 * ? formail -D 8192 msgid.cache
 | formail -A "X-Duplicate: yeah baby"
 LOCKFILE # release the regional lock

Here's an equivalent:

 :0Whc:msgid.lock
 | formail -D 8192 msgid.cache
  :0afwh # in case of success (i.e., if it is a duplicate)
  | formail -A "X-Duplicate: like, fer sherr"

If there are any differences in results or operation between those two,
I hope one of the experts will let us know.

BTW, I'm greatly in favor of setting PATH and calling executables by their
basenames over setting variables for every executable's absolute path and
invoking them all by their variables.

<Prev in Thread] Current Thread [Next in Thread>