procmail
[Top] [All Lists]

Re: conditioning on part of the email address

1998-03-04 00:09:36
On Tue, 3 Mar 1998, Wophet wrote:

1) Father(_dot_)Family(_at_)sameHost(_dot_)org
2)Mother(_dot_)Family(_at_)sameHost(_dot_)org

So how do I cut out the "mother | father" and then change the
subdirectory?

Here's an example of an rcfile I use for sorting mailinglists to their
appropriate folders. It is not exactly what you want to do but it is very
similar, and is case-insensitive, filing mail in a folder according to the
case you designate. This is readily adaptable to your needs. In this
example, formail is used to strip out headerfields that I don't want. 
David Hunt

# folders.rc
# This will preserve the case of the list's name as used in the var
# "mailinglists" when we use MATCH to write the foldername.

mailinglists=(cludgie|mycoculture|procmail|sorehand|smartlist|test|sendmail)
maildir=$HOME/mail

        :0
        * $ ^(To|Cc):(.*\<)?"$mailinglists"(-request|-owner)?@
        * $ ^(To|Cc):(.*\<)?\/"$mailinglists"
                { match=$MATCH }
        :0Aw:
        * $ mailinglists ?? ()\/"$match"
        |formail -I'Received:' -I'Resent-' -I'X-' -I'Content-' -z \
        >>$maildir/$MATCH

# eof