Hooking Points

A handler can be invoked at the hooking points described below.

Before queuing

Handlers can be called before the message is placed in the MTA queue. If this is a message being received by SMTP, the handlers are called synchronously during the SMTP session.

At this point, the message can have multiple recipients listed in the envelope. The handler can only take actions upon the message as whole, i.e. it cannot, for example, reject the message for some recipients while accepting it for the others.

Before local delivery

These handlers are called after reading a message from the MTA queue and deciding to deliver it to a local recipient. Note that messages to nonexistent local addresses are handled, too.

At this point, the message has exactly one recipient. Messages directed to multiple local recipients are split at an earlier stage. The handler can take actions upon the message directed to one recipient without affecting sibling messages directed to other local recipients.

Before remote delivery

These handlers are called after reading a message from the MTA queue and deciding to deliver it to a remote host.

At this point, the message can have multiple recipients. This happens only when the message is to be delivered to the same host for all of these recipients. If the message has multiple recipients for which remote delivery to different hosts is needed, such a message is split at an earlier stage.

Before SMTP data

These handlers are called after the envelop is sent, but before sending the body of a message (before the DATA command of SMTP protocol). Used by services that process only the messages headers, not their content.