procmail
[Top] [All Lists]

Re: Filter-list

1997-04-21 07:03:00
Jarl Groneng <gjarl(_at_)sn(_dot_)no> writes:
In my .procmailrc file I have 

:0 ch
* Subject:[    ]+\/.*
| grep '^From ' |formail -I"Subject: <$FROM> $MATCH" |/usr/lib/sendmail 
-oi my(_at_)new(_dot_)adress

This take out the From and Subject field and put it in Subject 
field of the new mail, no body message.

I want make a filter infront of this that maybe us a list to determin 
from who the mail was sent from. If the sender of the mail is on my list 
then the mail is sent to my(_at_)new(_dot_)adress, othervise it goes in my 
inbox.

Assuming you set FROM somewhere above, you can say:

        :0 ch
        * FROM ?? ^^<?(bob(_at_)somewhere|sarah(_at_)else\(_dot_)where)>?^^
        * Subject:[     ]+\/.*
        | formail -I"From " -I"Subject: <$FROM> $MATCH" | \
                $SENDMAIL $SENDMAILFLAGS my(_at_)new(_dot_)adress

Note that formail is perfectly capable of removing the "From " line
(no need for grep), though I must say that modern sendmails will delete
it themself, so you might not need to bother at all.  Also note the
use of the SENDMAIL and SENDMAILFLAGS variables, to abstract out the
location of sendmail and what flags to pass to sendmail.

Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>
  • Filter-list, Jarl Groneng
    • Re: Filter-list, Philip Guenther <=