procmail
[Top] [All Lists]

Re: empty message id

1998-01-14 05:44:36
On Tue, 13 Jan 1998 13:00:04 -0600 (CST), "Christopher P. Lindsey"
<lindsey(_at_)mallorn(_dot_)com> wrote:
   FROM=`formail -xFrom: | fgrep -i -f /etc/mail/FromOK`
   :0 c:
   * ^Message-Id:.*domain\.com>$
   * ^From [^(_at_)]+@[^ ]+
   * !FROM ?? .
   /scratch/spam

No real correction here, but it strikes me as counter-intuitive to
grab into FROM just to look whether it contains a character. The exit
code from fgrep will do nicely:

    :0c
    * ^Message-Id:(.*\<)?domain\.com\>$
    * ^From[    ]+[^    @]+(_at_)[^     @]+
    * ! ? formail -xFrom: | fgrep -i -f /etc/mail/FromOK
    /scratch/spam

This will also avoid spawning the formail+fgrep when the preceding
conditions don't match. 

Of course, if you need the FROM for something else, too, your method
is probably better. 

You could still get a mismatch if the From: contains a comment (in the
RFC822 sense) with a string that happens to be in the FromOK file. To
some extent, you can make sure the file contains only patterns that
are unlikely to match accidentally, or you can employ egrep and use
regular expressions instead of literal strings in the file to rule out
accidental matches entirely (or at least to a greater extent).

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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