procmail
[Top] [All Lists]

Re: formail -D generates empty msg. when duplicate found?

1999-12-11 13:08:54
Gary Funck wrote,

| What I see happening (v3.14, also 3.10) is that formail does detect
| duplicate messages.  However, when it finds a duplicate, its ends
| up tradting it as an empty message which it prepends a
| 'From foo(_at_)bar' to and then passes this message onto procamil,
| and the script.rc script.  I think it should just ignore the
| duplicate e-mail and move on.   Is this a bug?

No, that's pretty much the way it works.  The -f option (to formail, not to
procmail) would prevent that, but then you'd get procmail invoked on null
input.

| The workaround is simple, in script.rc, it check for, and discard
| the bogues message:
| 
| #
| # if the message id is duplicated, formail passes in an
| # empty email body, with a 1 line "From foo(_at_)bar'.  This
| # is a bug, I think - the workaround is to check, and
| # just dump the message.  Hoever, this won't work well
| # for mal-formed mail boxes.
| #
| :0 D
| * ^From foo(_at_)bar
| /dev/null
| 
| but this way of handlig things runs into problems, if for example,
| formail adds the dummy 'From foo(_at_)bar' line is added by formail
| for other reasons.

Easily overcome; just have procmail discard all messages without bodies,

 :0B
 * ^^($)*^^
 /dev/null

or if you get some legitimate mail without bodies,

 :0HB
 * ^^From foo(_at_)bar(_dot_)*($)+^^
 /dev/null

Finally, if none of the messages need to have From_ lines added, you could
add the -f option to formail and use this recipe in the procmail rcfile:

 :0
 * ! .
 /dev/null

Just put it at the top before any other recipes that might generate a From_
line.