procmail
[Top] [All Lists]

Re: Kind of functions in procmail

2001-11-16 10:54:02
At 15:30 2001-11-16 +0100, heddy Boubaker wrote:

 hi I'm looking for a way to factorize some parts of my procmailrc, as
 functions, for ex I've MANY rules like that

[snip]

You should try giving an example - even if not working - as to what you expect the resulting script might look like. It clarifies what you're trying to accomplish while at the same time engaging you in the process of learning how you might split the rules into parts -- I suspect you knew most of what you were trying to accomplish, but just didn't know the flags (which are all found in 'man procmailrc'.

[snip - original rules, rolled out]

See 'man procmailrc' for the meaning of 'E' and 'A' flags. If you're running programs in the rules (not the final 'common' delivery mechanism), you should instead use 'e' and 'a'. Again, see the manpage for descriptions.


# This FIRST one shouldn't use 'E'.
:0
* $ misc rule 1...
{
        SPAMREASON="misc rule 1 match ${MATCH}"
}

# The second, and all subsequent rules (before the 'common delivery') should
# use 'E'.
:0E
* $ misc rule 2...
{
        SPAMREASON="misc rule 2 match ${MATCH}"
}

# Note use of 'A'.  See manpage.
:0A
{
        LOG="${SPAMKILLERTAG}: ${SPAMREASON}
"
        :0 fwh
        | ${FORMAIL} -i "${XSPAMKILLERHEADER}: ${SPAMREASON}"

        # note addition of LOCKFILE (trailing : on flags)
        :0:
        ${SPAMFOLDER}
}

If spamfolder is an mbox, you can actually write those last two bits as:

        :0:
        | ${FORMAIL} -i "${XSPAMKILLERHEADER}: ${SPAMREASON}" >> ${SPAMFOLDER}

(I do something similar to insert a mailbox identifier on a copy of the message being delivered to $DEFAULT)

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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