SYNOPSIS

    use Mail::Milter::Chain;

my $chain = new Mail::Milter::Chain({ connect => \&foo, ... }, ...); $chain->register({ connect => \&bar, ... }); $chain->register({ connect => \&baz, ... });

$chain->accept_break(1);

use Sendmail::Milter; ... Sendmail::Milter::register('foo', $chain, SMFI_CURR_ACTS);

DESCRIPTION

Mail::Milter::Chain allows multiple milter callback sets to be registered in a single milter server instance, simulating multiple milters running in separate servers. This is typically much less resource intensive than running each milter in its own server process.

Any contained milter returning \s-1SMFIS_REJECT\s0, \s-1SMFIS_TEMPFAIL\s0, or \s-1SMFIS_DISCARD\s0 will terminate the entire chain and return the respective code up to the containing chain or milter server.

Normally, a milter returning \s-1SMFIS_ACCEPT\s0 will remove only that milter from the chain, allowing others to continue processing the message. Alternatively, \s-1SMFIS_ACCEPT\s0 can be made to terminate the entire chain as is done for error results; see \*(C`accept_break()\*(C' below.

A \*(C`Mail::Milter::Chain\*(C' is itself a milter callback hash reference, and can thus be passed directly to \*(C`Sendmail::Milter::register()\*(C' or another Mail::Milter::Chain container. \s-1IMPORTANT\s0 \s-1CAVEAT:\s0 Once this object has been registered with a parent container (a milter or another chain), \s-1DO\s0 \s-1NOT\s0 call \*(C`register()\*(C' on this object any longer. This will result in difficult to diagnose problems at callback time.

METHODS

new([\s-1HASHREF\s0, ...])

Creates a Mail::Milter::Chain object. For convenience, accepts one or more hash references corresponding to individual callback sets that will be registered with this chain.

accept_break(\s-1FLAG\s0)

If \s-1FLAG\s0 is 0 (the default), \s-1SMFIS_ACCEPT\s0 will only remove the current milter from the list of callbacks, thus simulating a completely independent milter server. If \s-1FLAG\s0 is 1, \s-1SMFIS_ACCEPT\s0 will terminate the entire chain and propagate \s-1SMFIS_ACCEPT\s0 up to the parent chain or milter server. This allows a milter to provide a sort of \*(L"whitelist\*(R" effect, where \s-1SMFIS_ACCEPT\s0 speaks for the entire chain rather than just one milter callback set. This method returns a reference to the object itself, allowing this method call to be chained.

register(\s-1HASHREF\s0)

Registers a callback set with this chain. Do not call after this chain has itself been registered with a parent container (chain or milter server).

AUTHOR

RELATED TO Mail::Milter::Chain…

Mail::Milter, Sendmail::Milter