procmail
[Top] [All Lists]

Re: Exit Codes

1996-08-14 14:14:44
Doug Krause <dijon(_at_)netcom(_dot_)com> writes:
How do I set an exit code to bounce mail?  I thought it was something
like:

:0
* ^From:(_dot_)*idiot(_at_)spam(_dot_)com
EXITCODE=67


You need to put the assignment in a nesting block.  Since nesting
blocks don't themselves count as delivering recipes (they can _contain_
delivering recipes, but they aren't ones themselves), you have to tell
procmail to stop processing your .procmailrc using a recipe inside the
block:

:0
* ^From:(_dot_)*idiot(_at_)spam(_dot_)com
{
    # EX_NOUSER = 67 from sysexits.h
    EXITCODE = 67
    :0
    /dev/null
}


However, there's a faster way to have procmail give up delivery: use
the HOST variable.  If you assign a value to the HOST variable which
isn't the same as the hostname of the machine procmail is running on,
then procmail gives up processing of the .procmailrc.  Thus:

:0
* ^From:(_dot_)*idiot(_at_)spam(_dot_)com
{
    # EX_NOUSER = 67 from sysexits.h
    EXITCODE = 67
    # Give up delivery
    HOST = .not.a.real.hostname.
}

Philip Guenther

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