2 <HEAD><TITLE>smfi_setreply</TITLE></HEAD>
5 $Id: smfi_setreply.html,v 1.17 2006/12/21 18:30:35 ca Exp $
9 <TABLE border="0" cellspacing=4 cellpadding=4>
10 <!---------- Synopsis ----------->
11 <TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
13 #include <libmilter/mfapi.h>
21 Set the default SMTP error reply code. Only 4XX and 5XX replies are accepted.
24 <!----------- Description ---------->
25 <TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
26 <TABLE border="1" cellspacing=1 cellpadding=4>
27 <TR align="left" valign=top>
28 <TH width="80">Called When</TH>
29 <TD>smfi_setreply may be called from any of the xxfi_ callbacks
30 other than xxfi_connect.</TD>
32 <TR align="left" valign=top>
33 <TH width="80">Effects</TH>
34 <TD>Directly set the SMTP error reply code for this connection. This code
35 will be used on subsequent error replies resulting from actions taken by
40 <!----------- Arguments ---------->
41 <TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
42 <TABLE border="1" cellspacing=0>
43 <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
44 <TR valign="top"><TD>ctx</TD>
45 <TD>Opaque context structure.
47 <TR valign="top"><TD>rcode</TD>
48 <TD>The three-digit (RFC 821/2821) SMTP reply code, as a
49 null-terminated string. rcode cannot be NULL, and must be a valid
50 4XX or 5XX reply code.
52 <TR valign="top"><TD>xcode</TD>
53 <TD>The extended (RFC 1893/2034) reply code. If xcode is NULL, no
54 extended code is used. Otherwise, xcode must conform to RFC 1893/2034.
56 <TR valign="top"><TD>message</TD>
57 <TD>The text part of the SMTP reply. If message is NULL, an empty message is used.
62 <!----------- Return values ---------->
64 <TH valign="top" align=left>RETURN VALUES</TH>
66 <TD>smfi_setreply will fail and return MI_FAILURE if:
68 <LI>The rcode or xcode argument is invalid.
69 <LI>A memory-allocation failure occurs.
71 Otherwise, it return MI_SUCCESS.
75 <!----------- Notes ---------->
76 <TR align="left" valign=top>
80 <LI>Values passed to smfi_setreply are not checked for standards compliance.
81 <LI>The message parameter should contain only printable characters,
82 other characters may lead to undefined behavior.
83 For example, CR or LF will cause the call to fail,
84 single '%' characters will cause the text to be ignored
85 (if there really should be a '%' in the string,
86 use '%%' just like for <TT>printf(3)</TT>).
87 <LI>For details about reply codes and their meanings, please see RFC's
88 <A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/
89 <A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A>
91 <A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/
92 <A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>.
93 <LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
94 for the message, the custom reply is not used.
95 <LI>Similarly, if the reply code (rcode) given is a '5XX' code but
96 SMFI_TEMPFAIL is used for the message, the custom reply is not used.
98 Note: in neither of the last two cases an error is returned to the milter,
99 libmilter silently ignores the reply code.
100 <LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
101 then the SMTP server will terminate the SMTP session with a 421 error code.
110 Copyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
113 By using this file, you agree to the terms and conditions set
114 forth in the LICENSE.