procmail
[Top] [All Lists]

RE: Yet another changing the subject question

2007-08-06 14:36:28
doug(_at_)safeport(_dot_)com wrote Sunday, August 05, 2007 3:10 AM:


SUBJECT=`formail -x Subject:`

Better:

  SUBJECT = `formail -zx Subject:`

Then you don't save the leading whitespace.

But you don't really need formail for this.  See below.

:0
  * ? (echo "$SUBJECT" | egrep -iqf $PMDIR/spam_subject)
  {
         LOG="subject"
         :0hfw
         | formail -I "Subject: [SPAM] $SUBJECT"
  }


  SPACE = ' '
  TAB = '       '
  WS = $SPACE$TAB
  NL = '
' SUBJECT   # initialize to null

  :0
  * $ ^Subject:.*\/[^$WS].*
  {
     SUBJECT = $MATCH

    :0 fw h
    * ? ( echo "$SUBJECT" | egrep -iqf $PMDIR/spam_subject )
    | formail -I "Subject: [SPAM] $SUBJECT"

    :0 A
    { LOG = SUBJECT$NL }
  }

Above is untested; let us know if there is any problem.


This as the last recipe in .procmailrc works just fine.
However, I want it to work where there last statement in
.procmailrc is:

:0
  ! user(_at_)anotherhost(_dot_)com

I tried various combinations of using :0c and putting a 
delivery rule inside the {}'s. Do I need to pipe the 
message into sendmail?

I'm unclear on what problem you are describing.  You
want to mail the message after you rewrite the Subject
line?  Just put what you have up there below the other
stuff in the nested brace set.  Use another A-flag
so it only operates if the egrep test succeeded.

There are other ways to set up the blocks of actions
too, of course.

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>