procmail
[Top] [All Lists]

Re: selective forwarding

1995-11-30 10:21:12
"Timothy J. Luoma" <luomat(_at_)cedman(_dot_)remote(_dot_)Princeton(_dot_)EDU> 
writes:
If an age old question, please direct me to the age old answer, but I 
wanted to ask if there was a way to forward only SOME messages (based on 
header contents).  It doesn't have to be very creative, just work.

Umm, have you checked the procmailex(5) manpage?  The first couple examples
on it do exactly this.

For a quick example (using current syntax.  procmail version >= 2.09):


# The :0 line starts the recipe.  Each line after that consists of a
# asterisk, whitespace, then a regexp.  These are the 'condition' lines.
# The final line is the action to be taken IF and ONLY IF *ALL* the regexps
# successfully match.  (I.e., conditions are anded.  If you want to 'or'
# several regexps, use the regexp '|' operator).
# The "^TO" regexp is a shorthand that matches any of the destination
# type headers (To:, Cc:, Bcc:, Resent-:, etc.).
# What an action does is determined mainly by the first (non-whitespace)
# character.  A '!' starts a forwarding recipe.  Check the procmailrc(5)
# manpage for more details.
# Oh yeah, any line starting with a '#' is ignored as a comment.
:0
*   ^TOsome-mailing-list(_at_)somewhere
*   ^Subject:.*(a subject|another interesting subject or maybe a|keyword)
    ! 
someone-else-who-should-subscribe-themselves-to-the-list(_at_)another(_dot_)site



Philip Guenther

----------------------------------------------------------------
Philip Guenther                 UNIX Systems and Network Administrator
Internet: guenther(_at_)gac(_dot_)edu   Phonenet: (507) 933-7596
Gustavus Adolphus College       St. Peter, MN 56082-1498
I am _not_ a representative sample of the Gustavus Community.  Yeah, right...
Source code never lies (it just misleads).  (Programming by Purloined Letter?)

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