procmail
[Top] [All Lists]

Re: Can't change the Subject:

2005-07-14 05:21:10
On Thu, Jul 14, 2005 at 06:38:42AM -0500, Michael Bluejay wrote:

Okay, I'm halfway there.  The second method works when I change 
$FORMAIL to formail.  But I prefer the first method since it's shorter, 
except it still doesn't work.  Here's my new code:

      :0
      * ^Subject:\/.*
      { SUBJECT = $MATCH }

      :0
      * textToMatch
      | formail  -I "Subject: SPAM - $SUBJECT"

That gives the following error in my logfile:

      Folder: formail -I Subject: SPAM -  textToMatch                     998

You're "delivering" the mail to formail, which is "eating"
it.  That's because you had wanted a non-delivering, "filter,"
action, but didn't specify the filter flag on the recipe.

    :0 fw
    * conditions
    | formail -I whatever


Btw, your SUBJECT recipe will match on an empty Subject
line.  In that case, your second condition is superfluous,
since there's nothing to match.  It will work, but it's
a tiny bit of needless extra work.  Similarly, your second
recipe will try to match the condition even if there was
NO Subject-line.  More needless work.  You could define SUBJECT
only for non-empty strings, and you could put an A-flag
on the second recipe so as not to bother with it
if there was no subject or an empty subject.  Also, let's
not test the entire header for the textToMatch, but only
what we just grabbed.

   :0  # space and tab after caret in brackets below
   * ^Subject:.*\/[^    ].*
   { SUBJECT = $MATCH }

   :0 A fw h
   * SUBJECT ?? some_regex
   | formail  -I "Subject: SPAM - $SUBJECT"


Same thing but perhaps cleaner, is this style:


   :0  # space and tab after caret in brackets below
   * ^Subject:.*\/[^    ].*
   {
     SUBJECT = $MATCH

     :0 fw h
     * SUBJECT ?? some_regex
     | formail  -I "Subject: SPAM - $SUBJECT"
   }


Dallman

____________________________________________________________
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>