procmail
[Top] [All Lists]

Re: formail not working?

1999-03-11 02:46:28
Bryan Mohr wants to do this:

if there is a header that matches "X-Rcpt-To: mlist(_at_)herp(_dot_)com" and
   there is not a header that matches "X-Loop: mlist(_at_)herp(_dot_)com" then
      Add a header that says "X-Loop: mlist(_at_)herp(_dot_)com" and
      Send the modified message to all email addresses listed in mlist.ppl
else
      continue through the rc file for further recipes
end if

Here are a few variations of the recipe that I've tried to accomplish this:

:0c
* ^X-Rcpt-To(_dot_)*mlist(_at_)herp(_dot_)com
* !^X-Loop: mlist(_at_)herp(_dot_)com
! formail -A "X-Loop: mlist(_at_)herp(_dot_)com"
! `cat mlist.ppl`
[and others with similar problems]

First, you can't have two action lines in one recipe like this, you
need braces for that. Second, "!" is procmail's "forward" symbol in an
action line (the rest of the line is taken as a list of addresses); 
if you want to send the message to a program like formail, you have to
use "|". Third, if you want to modify a message this way, you need the
"f" flag instead of "c" so that procmail continues processing with the
output of the invoked program. 

Something like this should be close to what you want:
        :0
        * ^X-Rcpt-To:(_dot_)*mlist(_at_)herp(_dot_)com
        * !^X-Loop: mlist(_at_)herp(_dot_)com
        {
                :0 fhw
                | formail -A "X-Loop: mlist(_at_)herp(_dot_)com"

                :0
                ! `cat mlist.ppl`
        }

/HW

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