Sendmail-Milter
view release on metacpan or search on metacpan
optional capability flags FLAGS. NAME is the same filter name that you would
pass to B<auto_setconn>. CALLBACKS is a hash reference that can contain any of
the following keys:
connect
helo
envfrom
envrcpt
header
eoh
body
eom
abort
close
The values for these keys indicate the callback routine that is associated with
each Milter callback. The values must be either function names, code references
or closures.
This function returns nonzero upon success, the undefined value otherwise.
B<%Sendmail::Milter::DEFAULT_CALLBACKS> is a hash with default function names
for all of the Milter callbacks. The default callback function names are:
B<connect_callback>, B<helo_callback>, B<envfrom_callback>,
B<envrcpt_callback>, B<header_callback>, B<eoh_callback>, B<body_callback>,
B<eom_callback>, B<abort_callback>, B<close_callback>.
See the section B<Writing Milter Callbacks> for more information on writing
the callbacks themselves.
For more information on capability flags, see the section B<Capability Flags>
in the B<@EXPORT> section.
=item main [MAX_INTERPRETERS] [, MAX_REQUESTS]
Starts the mail filter. If successful, this function never returns. Instead, it
launches the Milter engine which will call each of the callback routines as
appropriate.
MAX_INTERPRETERS sets the limit on the maximum number of interpreters that
B<Sendmail::Milter> is allowed to create. These interpreters will only be
created as the need arises and are not all created at startup. The default
value is 0. (No maximum limit)
MAX_REQUESTS sets the limit on the maximum number of requests an interpreter
will process before being recycled. The default value is 0. (Don't recycle
interpreters)
This function returns nonzero on success (if a kill was signaled or something),
the undefined value otherwise.
B<Note:> You should have at least registered a callback and set the connection
information string before calling this function.
=item setconn CONNECTION_INFO
Sets the connection information string for the filter. The format of this
string is identical to that found in the Milter documentation. Some examples
are C<local:/var/run/f1.sock>, C<inet6:999@localhost>, C<inet:3333@localhost>.
This function returns nonzero upon success, the undefined value otherwise.
=item auto_setconn NAME [, SENDMAIL_CF_FILENAME]
This function automatically sets the connection information by parsing the
sendmail .cf file for the appropriate X line containing the connection
information for the NAME mail filter and calling B<setconn> if it was
successful. It is provided as a helper function and does not exist in the
current Milter library.
B<Note:> This connection information isn't useful for implementing a Milter
that resides on a machine that is remote to the machine running sendmail. In
those cases, you will want to set the connection information manually with
B<setconn>.
This function returns nonzero upon success, the undefined value otherwise.
SENDMAIL_CF_FILENAME defaults to C</etc/mail/sendmail.cf> if not specified.
=item auto_getconn NAME [, SENDMAIL_CF_FILENAME]
Similar to B<auto_setconn>, this function parses the sendmail .cf file for the
appropriate X line containing the connection information for NAME. It does not,
however, call B<setconn>. It only retrieves the connection information.
This function returns the connection information string for NAME, or undef on
failure.
SENDMAIL_CF_FILENAME defaults to C</etc/mail/sendmail.cf> if not specified.
=item settimeout TIMEOUT
Sets the timeout for reads/writes in the Milter engine.
This function returns nonzero upon success, the undefined value otherwise.
=item setdbg LEVEL
Sets the debug level for the Milter engine.
This function returns nonzero upon success, the undefined value otherwise.
=back
=head2 Writing Milter Callbacks
Writing Milter callbacks is pretty easy when you're doing simple text
processing.
But remember one thing: Each Milter callback could quite possibly run in a
different instance of the Perl interpreter.
( run in 2.475 seconds using v1.01-cache-2.11-cpan-600a1bdf6e4 )