Callback functions
The sendmail filter must implement one or more of the callback functions, which are registered through smfi_register function.
Item | Description |
---|---|
xxfi_connect | The xxfi_connect function is called once at the start of each SMTP connection. The function returns SMFIS_CONTINUE value. |
xxfi_hello | The xxfi_hello function is called whenever the client sends a HELO/EHLO command. |
xxfi_envfrom | The xxfi_envfrom function is called at the beginning of a message. |
xxfi_envrcpt | The xxfi_envrcpt function is called for each recipient. |
xxfi_data | The xxfi_data function handles the DATA command. |
xxfi_unknown | The xxfi_unknown function handles unknown simple mail transfer protocol (SMTP) commands. |
xxfi_header | The xxfi_header function handles a message header. |
xxfi_eoh | The xxfi_eoh function handles the message headers. |
xxfi_body | The xxfi_body function handles a chunk of a messages body. |
xxfi_eom | The xxfi_eom function handles the end of the message. |
xxfi_abort | The xxfi_abort function handles the messages that are aborted. |
xxfi_close | The xxfi_close function is called to close the current connection. |
xxfi_negotiate | The xxfi_negotiate function is called at the start of SMTP connection. |
The callback functions must return proper value. If callback functions return any other value than the defined value, it constitutes an error, and the sendmail command terminates the connection to the filter.
- The recipient-oriented callback functions affect the processing of a single message recipient.
- The message-oriented callback functions affect a single message.
- The connection-oriented callback functions affect an entire connection (during which multiple messages can be delivered to multiple sets of recipients).
- The xxfi_envrcpt function is recipient-oriented. The xxfi_conect, xxfi_hello and xxfi_close functions are connection-oriented. All other callback functions are message-oriented.
Item | Description |
---|---|
SMFIS_CONTINUE |
Continue processing the current connection, message, or recipient. |
SMFIS_REJECT |
|
SMFIS_DISCARD |
|
SMFIS_ACCEPT |
|
SMFIS_TEMPFAIL |
Return a temporary failure, that is, the
corresponding simple mail transfer protocol (SMTP) command returns
|
SMFIS_SKIP |
Skip further callbacks of the same type in this transaction. Currently, this return value is only allowed in xxfi_body function. The return value can be used if a milter parameter has received sufficient body chunks to make a decision. But if the return value still wants to invoke the message modification functions that are only allowed to be called from xxfi_eom function. Note: The milter parameter
must negotiate this behavior with the mail transfer agent (MTA). The milter parameter
checks whether the protocol action SMFIP_SKIP is available. If the
protocol action SMFIP_SKIP is available, the milter parameter
must request it.
|
SMFIS_NOREPLY |
|