procmail
[Top] [All Lists]

Re: ackmail.rc not acking correctly?

1999-12-01 17:22:05
Era suggested to Mark,

E> You could of course say something like
E> 
E>      :0
E>      * ! ^TO(_at_)mediaone(_dot_)net
E>      { INCLUDERC=ackmail.rc }

Mark responded,

H> This worked wonderfully, btw. :)

Beats me how.  That regexp should never match, so the condition, being
negated, should always pass, and the INCLUDERC should always be processed.

The expansion of ^TO cannot end in a letter or a digit, and I'd tend to
expect that the local part of an address @mediaone.net will almost always
end with such a character.  It really ought to look more like this;

   :0
   * ! ^TO[a-z0-9_]+(_at_)mediaone\(_dot_)net
   { INCLUDERC=ackmail.rc }

H> I also changed:

H>      # Get the subject
H>      :0 ch
H>      SUBJ=| formail -zX'Subject:' | sed -e 's/["~]//g' -e 's/^ *[Rr]e: *//g'
H>      SUBJ="${SUBJ:-'(no subject)'}"

H> and just made SUBJ a variable with:

H>      SUBJ=`formail -xSubject:`

That's much better, Mark.  Another thing that was wrong with the original
was the redundant `c' flag on a variable capture recipe.  You might want,
though, to put the -z option back, as usually there will be a space after
the colon in the subject header, and you probably won't want a leading space
in $SUBJ.

Here's a suggestion for handling both that and empty incoming subjects, and
saving a process by not calling formail there at all:

   SUBJ='(no subject)' # default value
   :0h # if there is a non-blank subject, use that instead
   * ^Subject:[         ]*\/[^  ].*
   { SUBJ=$MATCH }

The first set of brackets enclose space and tab; the second set enclose 
caret, space, and tab.  You could actually write it this way because of
procmail's stingy matching to the left of extractors:

   * ^Subject:.*\/[^    ].*

but it is too easy to misread.

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