Milter smfi_setreply()

Tune how messages are rejected All sendmail versions

The reply code and message that sendmail uses to reject or temp-fail the current message is set by calling the smfi_setreply() Milter library routine. That routine accepts four arguments:

ret  = smfi_setreply(ctx, rcode, dsncode, message);

Here, the rcode specifies the SMTP reply number that sendmail should return. The rcode is in the form of a three-digit string that must begin with a 4 or a 5.

The dsncode must either be NULL or a string containing three integers with a dot separating each integer from the next. For example:

"5.7.1"

If the first integer is not a 4 or 5, the smfi_setreply() routine will return MI_FAILURE. Similarly, if the three integers are not composed of all digits, or if the character positions that should be occupied by dots are not occupied by dots, the smfi_setreply() routine will also return MI_FAILURE. If dsncode is NULL, it is ignored and a default DSN return value will be generated by sendmail.

The last argument, the msg, is a string which specifies a new rejection or temp-fail message:

"Go away, evil spammer"

If the string is longer than 980 characters, or if it contains a carriage-return (\r) or linefeed character (\n), the smfi_setreply() routine will return MI_FAILURE. If msg is NULL, it is ignored and no message will be issued as part of the reply.

Each time smfi_setreply() is called, it frees any prior message and replaces it with the new one.

The Milter library, except for the single ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.