smfi_setreply Function
Purpose
The smfi_setreply function
sets the default simple mail transfer protocol (SMTP) error reply
code and accepts only 4XX
and 5XX
reply
codes.
Syntax
#include <libmilter/mfapi.h>
int smfi_setreply
SFICTX *ctx,
char *rcode,
char *xcode,
char *message
);
Description
The smfi_setreply function is called from any of the xxfi_ callback functions other than the xxfi_connect function. The smfi_setreply function sets the SMTP error reply code for the connection. This code is used for subsequent error replies resulting from actions taken by this filter.
The values passed to the smfi_setreply function are not checked for standards compliance.
For details about reply codes and their meanings, see RFC 821 or 2821 and RFC 1893 or 2034.
If the rcode argument
is set as 4XX
but, the SMFI_REJECT value is used
for the message, the custom reply is not used.
5XX
but, the SMFI_TEMPFAIL value is used
for the message, the custom reply is not used. If the milter parameter returns the SMFI_TEMPFAIL
value and sets the reply code to 421
, the SMTP server
terminates the SMTP session with a 421
error code.
Arguments
Item | Description |
---|---|
ctx | The opaque context structure is maintained in the libmilter parameter. |
rcode | The three-digit ( RFC
821 or 2821) SMTP reply code is a null-terminated
string. rcode cannot be NULL, and must be a valid 4XX or 5XX reply
code. |
xcode | The extended (RFC 1893 or 2034) reply code. If xcode is NULL, extended code is not used. Otherwise, xcode must conform to RFC 1893 or 2034. |
message | The text part of the SMTP reply. If message is NULL, an empty message is used. |
Return values
- The rcode or xcode argument is invalid.
- A memory-allocation failure occurs.