Set the default SMTP error reply code to a multi-line response. Only 4XX
and 5XX replies are accepted.
||smfi_setmlreply may be called from any of the xxfi_ callbacks
other than xxfi_connect.
||Directly set the SMTP error reply code for this connection to the given
lines after the xcode. The list of arguments must be NULL terminated.
This code will be used on subsequent error replies resulting from actions
taken by this filter.
||Opaque context structure.
||The three-digit (RFC 821/2821) SMTP reply code, as a
null-terminated string. rcode cannot be NULL, and must be a valid
4XX or 5XX reply code.
||The extended (RFC 1893/2034) reply code. If xcode is NULL, no
extended code is used. Otherwise, xcode must conform to RFC 1893/2034.
||The remainder of the arguments are single lines of text, up to
32 arguments, which will be used as the text part of the SMTP
reply. The list must be NULL terminated.
For example, the code:
ret = smfi_setmlreply(ctx, "550", "5.7.0",
"Spammer access rejected",
"Please see our policy at:",
would give the SMTP response:
550-5.7.0 Spammer access rejected
550-5.7.0 Please see our policy at:
550 5.7.0 http://www.example.com/spampolicy.html
||smfi_setmlreply will fail and return MI_FAILURE if:
Otherwise, it return MI_SUCCESS.
- The rcode or xcode argument is invalid.
- A memory-allocation failure occurs.
- If any text line contains a carraige return or line feed.
- The length of any text line is more than MAXREPLYLEN (980).
- More than 32 lines of text replies are given.
- Values passed to smfi_setmlreply are not checked for standards compliance.
- The message parameter should contain only printable characters,
other characters may lead to undefined behavior.
For example, CR or LF will cause the call to fail,
single '%' characters will cause the text to be ignored
(if there really should be a '%' in the string,
use '%%' just like for printf(3)).
- For details about reply codes and their meanings, please see RFC's
- If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
for the message, the custom reply is not used.
- Similarly, if the reply code (rcode) given is a '5XX' code but
SMFI_TEMPFAIL is used for the message, the custom reply is not used.
Note: in neither of the last two cases an error is returned to the milter,
libmilter silently ignores the reply code.
- If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
then the SMTP server will terminate the SMTP session with a 421 error code.