procmail
[Top] [All Lists]

Re: Rule not being honored. Why?

2009-02-10 13:50:04
* Christopher L. Barnard wrote:
From: root on nbmaster001 
<root(_at_)rudun-nbmaster001(_dot_)cc1(_dot_)rush(_dot_)edu>

I have modified my rule to honor both the From_ and From: line.  It is
the From: I am talking about; if I do not tell my mailer to explicitly
dump the headers it writes the 'From: ' as 'From '.

The rule:

[...]
SPACE   =' '
TAB     ='      '
WS      =$SPACE$TAB
[...]
###
VERBOSE=on
:0:
* ^From[$WS]*root(_at_)rudun-nbmaster002\(_dot_)cc1\(_dot_)rush\(_dot_)edu
* ^Subject[$WS]*L700 NetBackup
/opt/home/cbarnard/backups

Two problems:

1) You're trying to look for:
  - beginning of line
  - "From"
  - an arbitrary number of whitespace characters
  - "root(_at_)rudun-nbmaster001(_dot_)cc1(_dot_)rush(_dot_)edu"

  If you really want to check the "From:" line, that simply doesn't
  match: there's a colon and a "root on nbmaster001" in there, not just
  whitespace. Likewise for the Subject line that also has a colon.

2) For the "From " line, that would indeed work, but there's a catch in
  procmail recipe syntax: "$" by default has its regexp meaning "end of
  line" instead of "here's a variable", so in fact "[$WS]" doesn't check
  for whitespace, but for either end of line, "W" or "S". You need an
  additional "$" in front of the condition line to change that behavior:

  * $ ^From[$WS]*root(_at_)rudun-nbmaster002\(_dot_)cc1\(_dot_)rush\(_dot_)edu

  should deal properly with the "From " line.

For the "From:" line, something like

  * ^From:.*<root(_at_)rudun-nbmaster002\(_dot_)cc1\(_dot_)rush\(_dot_)edu>

should do just fine too, though.

/HW
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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