procmail
[Top] [All Lists]

Announce: Subroutine to detect mailing list messages

1998-06-16 09:14:58

    Hi,

    I've subscribed to numerous mailing lists and as many of you,
    I guess, I have added a little piece of recipe to catch the
    mailing list and save it to folder. When I subscribe to new
    mailing list, I have to manually add new recipe to trap the
    messages...

    Tedious? Yes. Needs manual work? Yes. Any other
    solutions? Yes!

    I wrote a general procmail subroutine to automatically detect
    mailing list name from the message's headers and I then wiped
    out all my previous little recipes:
        
        [N times]

        :0
        * Received:.*list-that
        $LIST_THAT_SPOOL

    I replaced them with a very simple "drop that mailing list message
    to folder" recipe. I can now subscribe to new mailing lists without
    touching the procmailrc at all. The recipe will adapt to all new 
    mailing lists.

    Docs attached below. The new module is included in newest pm-code.shar

        To: jari(_dot_)aalto(_at_)poboxes(_dot_)com
        Subject: send pm-code.shar

    Cheers!
    jari

Pm-jalist.rc -- Subroutine to detect mailing LIST from message.

    File id
 
        .Copyright (C)  1998 Jari aalto 
<jari(_dot_)aalto(_at_)poboxes(_dot_)com>
        .Contactid:     <jari(_dot_)aalto(_at_)poboxes(_dot_)com>
        .Created:       1998-06
        .Keywords:      procmail subroutine list detect
 
        This code is free software in terms of GNU Gen. pub. Lic. v2 or later
        You can get newest version by sending email to maintainer with
        subject "send <FILENAME>"
 
    Description
 
        You can toss away your specialized mailing list detecting recipes
        after installing this subroutine and one single recipe. New mailing
        lists are detected when you subsribe to them. When you keep the
        folder name same as what appears in the mailing list name, then saving
        list messages is a breeze. Interesting mailing lists can be found at
 
            http://www.lsoft.com/lists/listref.html
 
        If you can use sendmail PKUS addressing capabillities, you can
        manage receiving yout mailing list messages very easily. Let's
        suppose you want to subscribe to procmail maling list and want to
        save all messages from list to folser list.procmail, then you'd
        subribe with address:
 
            login+list(_dot_)procmail(_at_)site(_dot_)com
 
        The extra information after "+" is available to your procmail
        scripts via the $ARG pseudo variable when procmail is the LDA. Many
        of us are not that fortunate. We have to subscribe to mailing lists
        with our regular login address
 
            login(_at_)site(_dot_)com
 
        And then try to examine varaious headers, like Reveived,
        X-maling-list and other headers that dozen mailing lists software
        uses. This subroutine tries to detect and derive the mailing list
        name as it appears in some of the know methods that ezlm, smarlist,
        listserv, majordomo etc normally use. After this subroutine has
        been applied to message the variable `LIST' contains the mailing
        list name.
 
        When you use this subroutine, you no longer need to write separate
        mailing list recipes to your .procmailrc every time you subscribe
        to a new mailing list. The detection of new list happens in this
        subroutine automatically.
 
    Ask for help
 
        If you find maling lists that this subroutine does not detect, but
        which could have been detected by looking the headers in standard
        way, please drop maintaeiner a email. There may be cases where it
        is impossible to detect the mailing list and in those cases you
        just has to carve a new entry to your procmailrc after thios
        general mailing list detector.
 
        When you keep your procmail log running, you may see message
 
             *** potential list ***
 
        Which is an indication that some new recipe could be added to
        to this subroutine to detect that mailing list. If the message
        you received from from mailing list, please send all the Headers
        for the maintainer so that support can be added.
 
    Required settings
 
        PMSRC must point to source direcry of procmail code. This subroutine
        will include pm-javar.rc from there.
 
        o   pm-javar.rc is needed and must reside along $PMSRC
 
    Call arguments (variables to set before calling)
 
        `JA_LIST_USE_SHELL'
 
        This variable controls if shell is called to remove
        "-request|-help|-owner" words from list name. Procmail can easily
        reduce prefixes:
 
            owner-list-name --> list-name
 
        but it can't easily remove words to the right. This would
        require calling shell and command `expr':
 
            list-name-owner --> list-name
 
        Value is by default "no" to prevent shell calls. If you have
        subsribe to high volume mailing lists or to many mailing lists,
        I suggest strongly that you leave it that way to prevent creating
        extra processes.
 
        Value "yes" removes the tag keywords.
 
    Example: basic installation
 
        Here is recipe to save all your mailing list to separate folders.
        If you subsribe to new lists or unsubsribe to lists, you don't
        need to change anything.
 
            RC_LIST = $PMSRC/pm-jalist.rc   # name the subroutine
            ...
            INCLUDERC = $RC_LIST
 
            :0
            * ! LIST ?? ^^^^
            {
                # the LIST will contain the found list name. Drop
                # this message to mailing list folder
 
                :0
                $LIST_SPOOL_DIR/list.$LIST
            }
 
    Example: changing the matches list name
 
        You can also convert the the detected maling list names to something
        else with simple procmail match. Eg. if you keep the
        `JA_LIST_USE_SHELL' "no" then you don't want to have the
        "-help" word to appear in folder name: Let's assume that `LIST'
        contain list1-help. to convert it to just list name, you'd use:
 
            table = "\
            list1-help list1,\
            list2-owner list2,\
            "
 
            :0
            *$ table ?? $LIST.\/[^,]+
            {
                LIST = $MATCH
            }
 
        Don't be confused by the regexp. It just matches the list name first,
        then the "alias" name it stored to MATCH up till colon. The
        a' portion matches before and b' matches after the \/ operator.
        The colon is excluded because the character set negates colon.
 
            list1-helplist1,
            aaaaaaaaaa
                      bbbbb
 
        NOTE: you can use this same approach to conver the matches list
        names to lowercase letters. suppose that the grabbed LIST were
        all uppercase, then you would make translate table as above.
 
            table = "LIST list,"
 
Pm-jalist.rc -- Subroutine to detect mailing LIST from message.

    File id
 
        .Copyright (C)  1998 Jari aalto 
<jari(_dot_)aalto(_at_)poboxes(_dot_)com>
        .Contactid:     <jari(_dot_)aalto(_at_)poboxes(_dot_)com>
        .Created:       1998-06
        .Keywords:      procmail subroutine list detect
 
        This code is free software in terms of GNU Gen. pub. Lic. v2 or later
        You can get newest version by sending email to maintainer with
        subject "send <FILENAME>"
 
    Description
 
        You can toss away your specialized mailing list detecting recipes
        after installing this subroutine and one single recipe. New mailing
        lists are detected when you subsribe to them. When you keep the
        folder name same as what appears in the mailing list name, then saving
        list messages is a breeze. Interesting mailing lists can be found at
 
            http://www.lsoft.com/lists/listref.html
 
        If you can use sendmail PKUS addressing capabillities, you can
        manage receiving yout mailing list messages very easily. Let's
        suppose you want to subscribe to procmail maling list and want to
        save all messages from list to folser list.procmail, then you'd
        subribe with address:
 
            login+list(_dot_)procmail(_at_)site(_dot_)com
 
        The extra information after "+" is available to your procmail
        scripts via the $ARG pseudo variable when procmail is the LDA. Many
        of us are not that fortunate. We have to subscribe to mailing lists
        with our regular login address
 
            login(_at_)site(_dot_)com
 
        And then try to examine varaious headers, like Reveived,
        X-maling-list and other headers that dozen mailing lists software
        uses. This subroutine tries to detect and derive the mailing list
        name as it appears in some of the know methods that ezlm, smarlist,
        listserv, majordomo etc normally use. After this subroutine has
        been applied to message the variable `LIST' contains the mailing
        list name.
 
        When you use this subroutine, you no longer need to write separate
        mailing list recipes to your .procmailrc every time you subscribe
        to a new mailing list. The detection of new list happens in this
        subroutine automatically.
 
    Ask for help
 
        If you find maling lists that this subroutine does not detect, but
        which could have been detected by looking the headers in standard
        way, please drop maintaeiner a email. There may be cases where it
        is impossible to detect the mailing list and in those cases you
        just has to carve a new entry to your procmailrc after thios
        general mailing list detector.
 
        When you keep your procmail log running, you may see message
 
             *** potential list ***
 
        Which is an indication that some new recipe could be added to
        to this subroutine to detect that mailing list. If the message
        you received from from mailing list, please send all the Headers
        for the maintainer so that support can be added.
 
    Required settings
 
        PMSRC must point to source direcry of procmail code. This subroutine
        will include pm-javar.rc from there.
 
        o   pm-javar.rc is needed and must reside along $PMSRC
 
    Call arguments (variables to set before calling)
 
        `JA_LIST_USE_SHELL'
 
        This variable controls if shell is called to remove
        "-request|-help|-owner" words from list name. Procmail can easily
        reduce prefixes:
 
            owner-list-name --> list-name
 
        but it can't easily remove words to the right. This would
        require calling shell and command `expr':
 
            list-name-owner --> list-name
 
        Value is by default "no" to prevent shell calls. If you have
        subsribe to high volume mailing lists or to many mailing lists,
        I suggest strongly that you leave it that way to prevent creating
        extra processes.
 
        Value "yes" removes the tag keywords.
 
    Example: basic installation
 
        Here is recipe to save all your mailing list to separate folders.
        If you subsribe to new lists or unsubsribe to lists, you don't
        need to change anything.
 
            RC_LIST = $PMSRC/pm-jalist.rc   # name the subroutine
            ...
            INCLUDERC = $RC_LIST
 
            :0
            * ! LIST ?? ^^^^
            {
                # the LIST will contain the found list name. Drop
                # this message to mailing list folder
 
                :0
                $LIST_SPOOL_DIR/list.$LIST
            }
 
    Example: changing the matches list name
 
        You can also convert the the detected maling list names to something
        else with simple procmail match. Eg. if you keep the
        `JA_LIST_USE_SHELL' "no" then you don't want to have the
        "-help" word to appear in folder name: Let's assume that `LIST'
        contain list1-help. to convert it to just list name, you'd use:
 
            table = "\
            list1-help list1,\
            list2-owner list2,\
            "
 
            :0
            *$ table ?? $LIST.\/[^,]+
            {
                LIST = $MATCH
            }
 
        Don't be confused by the regexp. It just matches the list name first,
        then the "alias" name it stored to MATCH up till colon. The
        a' portion matches before and b' matches after the \/ operator.
        The colon is excluded because the character set negates colon.
 
            list1-helplist1,
            aaaaaaaaaa
                      bbbbb
 
        NOTE: you can use this same approach to conver the matches list
        names to lowercase letters. suppose that the grabbed LIST were
        all uppercase, then you would make translate table as above.
 
            table = "LIST list,"
 



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