anomy-list

Re: Procmail for dummies

From: 53679@xyz.molar.is
Date: Wed 18 Sep 2002 - 15:48:20 GMT

  • Next message: Smart, Dan: "RE: Procmail for dummies"

    Procmail has a very steep learning curve, but is power is quite
    impressive.
    If you want to redirect mail to specific users on that system, then you
    could end a recipe with the line "! 53720@xyz.molar.is"
    That isn't flaky at all. Its a bit more trouble to do this from a
    systemwide procmailrc.
    I would suggest starting by reading "man procmailrc", for some information
    on the configuration file, and "man procmailex" for some configuration
    examples.
    I think you would want to use the "To" function in a recipe's search, to
    select a specific recipient domain, for a specific filter.
    Have you read the postfix.txt file in the contrib directory of the Anomy
    distribution. I am not familiar with postfix, and I just took a look at
    this file, but I'm using it for a common reference point to give you some
    direction.

    In section 4, the file refers to the file /etc/procmailrc, with entries
    of:

    :0 c
      /home/mail-backup

    ANOMY=/usr/local/anomy/
    :0 fw
       |/usr/local/anomy/bin/sanitizer.pl /etc/sanitizer.cfg

    The first line, just copies all of the mail to an mbox style file named
    /home/mail-backup
    The ":0" begins the recipe, and the "c" says to copy the data, and not to
    drop anything.
    The "ANOMY=/usr/local/anomy/" just sets an environment variable which
    tells the sanitizer where it lives (that need to be where you put it, but
    /usr/local/anomy is a good location).
    The ":0 fw" is a new recipe which filters the mail, and waits for the
    output.
    The mail is then filtered as input to the program
    "/usr/local/anomy/bin/sanitizer.pl" with the command line option selecting
    "/etc/sanitizer.cfg" as its configuration.

    Replacing this recipe with the following two recipes:

    :0 fw
    * ^To:.*example1\.com
       |/usr/local/anomy/bin/sanitizer.pl /etc/sanitizer.cfg1

    :0 fw
    * ^To:.*example2\.com
       |/usr/local/anomy/bin/sanitizer.pl /etc/sanitizer.cfg2

    Would take mail directed to a specific 53757@xyz.molar.is, and sanitize it
    with the sanitizer.cfg1 ruleset, and would filter mail to a
    53794@xyz.molar.is using the sanitizer.cfg2 ruleset.

    NB, that THIS EXAMPLE IS -VERY- BAD!
    I only mentioned it to point out how very easy it is to goof up in a
    regular expression.
    This will ONLY filter mail sent "To" a user. CC, and BCC, etc will not be
    filtered. :(
    Fortunately, procmail has set up some neat predefined regular expressions
    to help with this.
    Replacing the "^To:" with "^TO_" or "^TO" will substitute in a rather
    large regular expression to help this out. I leave it up to you to figure
    out the difference between the two (hint: its in the procmailrc man page)

    Does this help any?

      _______________________________________
     /\ \
    | |\ Robert C. Litman \
    | | | |
    \/__| http://www.rlitman.com |
        | ftp://ftp.rlitman.com |
      __| |
     /\ | Desk: (631) 501-2572 |
    | | | Fax: (631) 514-6626 |
    | |/ 53831@xyz.molar.is /
    \/_______________________________________/

    "Wil McGilvery" <53590@xyz.molar.is>
    09/18/2002 10:53 AM

     
            To: <53629@xyz.molar.is>
            cc:
            Subject: [anomy-list]: Procmail for dummies

    I am currently running a Postfix Server that acts as a gateway and as a
    local mail host for several domains. I have been experimenting with Anomy
    and SpamAssassin and I wish to be able to set different filter settings
    for each domain. I also do not wish to filter outgoing mail. (I currently
    use a script (not procmail) that filters all mail that arrive at the
    server.)

    I have been reading up on Procmail and it appears that it can only be used
    to direct mail locally. I found a "To" function that that could be used to
    redirect mail, but I also read that this set up is flaky at best.

    What have other people done? Where can I find a "How To" For the procmail
    challenged?

    Regards,

    Wil McGilvery
    Manager, Digital Media

    Lynch Technologies Inc.
    416-744-7191
    1-888-622-3729
    416-744-0406 FAX
    www.lynchdigital.com

    Attachments:
     + http://mailtools.anomy.net/archives/anomy-list//19/8e/3d88a05d/01.unnamed.html



    hosted by molar.is