On Wed, Jan 23, 2013 at 10:58:37AM +0800, horseriver wrote:
> hi:
>
>    How to edit my .procmailrc to put mails from  different mail list into 
> different maildir?
>
>    can this work : 
>    :0
>    * ^to: mutt-users@mutt.org
>    mutt-users@mutt.org
>
> thanks

This is a configuration that I used to use:

    # Mailing List Classification {{{

    # This is a method/recipe that I ganked from [1]. I liked the idea of #
    # separating filtering out into 'classicifation' and 'delivery' # phases.
    # 
    # Sources
    # -------
    #   [1]: http://aperiodic.net/phil/configs/procmailrc


    # most lists; RFC-2919
    :0 fhw
    * ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>@\.\/]*))
    | formail -I "X-List-Classify: $MATCH"

    # majordomo
    :0 fhw
    * ^Sender: owner-[^@]+@[^@\+]+
    * ^Sender: owner-\/[^@\+\.\/]+
    | formail -I "X-List-Classify: $MATCH"

    # librelist.com mailing lists
    :0 fhw
    * ^List-Id: \/[^@<]+@librelist\.(com|org)
    {
        LISTID=cho $MATCH | sed -e 's/@librelist\.\(com\|org\)//'
        :0 fhw
        |formail -I "X-List-Classify: $LISTID"
    }

    # yahoogroups
    :0 fhw
    * ^Mailing-List: list \/[^@\.\/]+
    | formail -I "X-List-Classify: $MATCH"

    # ezmlm
    :0
    * ^Mailing-List: contact \/[^@\+\.\/]+
    {
        LISTID=cho $MATCH | sed -e 's/-help$//'
        :0 fhw
        | formail -I "X-List-Classify: $LISTID"
    }

Even with that, some things specific required intervention. Some lists have
generic names like 'alerts':

    # All of the CERT listnames are generic (e.g. 'alerts') so, just throw
    # them all under a single listname that makes sense.
    :0 fhw
    * ^List-Id: .*us-cert\.gov
    | formail -I "X-List-Classify: us-cert"

Or:

    :0 fhw
    * ^Reply-To: *Bug [0-9]+ <[0-9]+@bugs\.launchpad\.net>
    | formail -I "X-List-Classify: launchpad"

Then there was mailing list delivery (after using X-List-Classify to sort):

    # Mailing List Delivery {{{

    # This is a method/recipe that I ganked from [1]. I liked the idea of
    # separating filtering out into 'classicifation' and 'delivery' phases.
    # 
    # Sources
    # -------
    #   [1]: http://aperiodic.net/phil/configs/procmailrc

    :0
    * ^X-List-Classify: \/[0-9a-z-]+
    {
        LIST=$MATCH
        LOG="[list=$LIST] "

        # Short-Ciruit {{{
        ##########
        # Short-Circuit
        #   Deal with mailing list emails that should end up in the inbox
        #   instead of on the mailing list.
        #
        #
        # List management email go to the inbox
        :0
        * ^Message-ID: <mailman
        $DEFAULT/
        #
        # List management emails from ezmlm go to the inbox
        :0
        * ^Message-ID: <[0-9.]+.ezmlm-warn@
        $DEFAULT/
        #
        # zsh-users doesn't match the pattern above, so look for the
        # LISTNAME-help pattern
        :0
        * ^Mailing-List: contact $LIST-help
        $DEFAULT/

        # }}}

        [...]

        # For reading.
        :0 c
        lists.$LIST/

        # Prepare for the archive.
        :0 fhw
        | formail -I "Received" -I "Delivered-To"

        # Archive locally.
        :0
        archives.$LIST/

    }

    # }}}

In general though, I just cut back on most of the mailing lists that I was on
(as I rarely read them all). Now everything just hits my inbox.

Note: This setup is stupidly complex, but it should give you some ideas of what
you can do and some of the general header patterns that some mailing list
software follows. I also clipped out some of the mailing list cleanup recipes I
had (i.e. removing [LIST-NAME] from the subject; compressing strands of "Re:"s
down to a single one; etc).
-- 
Brandon Sandrowicz

Reply via email to