Sendmail 8.13.3 Programmer's Guide

Milter APIs
Data Access APIs
Chapter 2 21
The smfi_setreply() API
You can use the smfi_setreply() API to set the default SMTP error
reply code. Only 4xx and 5xx replies are accepted. You can call
smfi_setreply() from any of the xxfi_* callbacks other than the
xxfi_connect() callback. smfi_setreply() directly sets the SMTP
error reply code for a connection. If subsequent error occurs because of
an action taken by the filter, analyze the error code to identify the
problem.
The declaration of smfi_setreply() is as follows:
#include <libmilter/mfapi.h>
int smfi_setreply(
SMFICTX *ctx,
char *rcode,
char *xcode,
char *message
);
Following are some points to consider regarding smfi_setreply():
Values passed to smfi_setreply() are not checked for standards
compliance.
The message parameter must contain only printable characters;
other characters can result in undefined behavior. For example, CR
or LR causes the call to fail, a single % (percentage) character causes
the text to be ignored (if a % is required in a string, use %% similar to
the usage in printf (3)).
If the reply code (rcode) is 4XX but SMFI-REJECT is used for the
message, the custom reply is not used.
Similarly, if the reply code (rcode)is5XX code but SMFI_TEMPFAIL is
used for the message, the custom reply is not used.
NOTE An error is not returned to the Milter program in neither of the
previous two instances; libmilter silently ignores the reply code.
For details on reply codes and their meanings, see RFC 821 (SIMPLE
MAIL TRANSFER PROTOCOL) or 2821 (Simple Mail Transfer
Protocol) and RFC 1893 (Enhanced Mail System Status Codes) or
2034 (SMTP Service Extension for Returning Enhanced Error Codes).