Previous: Global startup and shutdown handlers., Up: Initialization and Cleanup Handlers [Contents][Index]
Action hook handler is run implicitly before executing each reply
action, such as accept, reject, etc. See reply actions, for a discussion of reply action statements.
Upon invocation, the handler is passed six arguments:
status
module defines the following symbolic names for action identifiers:
To convert these to textual action names, use the
milter_action_name function (see milter_action_name).
Last three arguments are meaningful only for reject and
tempfail actions. For the remaining three actions
(accept, discard, and continue), empty strings
are passed.
Action hook handlers are useful mainly for logging and accounting
purposes. For example, the code fragment below assumes that the
openmetrics module is used (see mfmod_openmetrics in mfmod_openmetrics reference).
It increases the corresponding metrics before taking the action.
Additionally, for reject and tempfail actions, the
metrics ‘reject_code’ and ‘tempfail_code’ are
increased, where code is the three-digit SMTP status code being
sent to the server.
prog action
do
openmetrics_incr(milter_action_name($1))
switch $1
do
case REJECT_ACTION:
openmetrics_incr("reject_" . $2)
case TEMPFAIL_ACTION:
openmetrics_incr("tempfail_" . $2)
done
done