smfi_setreply.html revision 132943
1<html>
2<head><title>smfi_setreply</title></head>
3<body>
4<!--
5$Id: smfi_setreply.html,v 1.14 2003/11/16 05:04:01 ca Exp $
6-->
7<h1>smfi_setreply</h1>
8
9<table border="0" cellspacing=4 cellpadding=4>
10<!---------- Synopsis ----------->
11<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
12<pre>
13#include &lt;libmilter/mfapi.h&gt;
14int smfi_setreply(
15	SMFICTX *ctx,
16	char *rcode,
17	char *xcode,
18	char *message
19);
20</pre>
21Set the default SMTP error reply code.  Only 4XX and 5XX replies are accepted.
22</td></tr>
23
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
30other than xxfi_connect.</td>
31</tr>
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 
35will be used on subsequent error replies resulting from actions taken by 
36this filter.</td>
37</tr>
38</table>
39
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.
46	</td></tr>
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.
51        </td></tr>
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.
55	</td></tr>
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.
58	</td></tr>
59    </table>
60</td></tr>
61
62<!----------- Return values ---------->
63<tr>
64<th valign="top" align=left>RETURN VALUES</th> 
65
66<td>smfi_setreply will fail and return MI_FAILURE if:
67<ul>
68    <li>The rcode or xcode argument is invalid.
69    <li>A memory-allocation failure occurs.
70</ul>
71Otherwise, it return MI_SUCCESS.
72</td>
73</tr>
74
75<!----------- Notes ---------->
76<tr align="left" valign=top>
77<th>NOTES</th> 
78<td>
79<ul>
80<li>Values passed to smfi_setreply are not checked for standards compliance.
81<li>The message parameter should contain only printable characters,
82other characters may lead to undefined behavior.
83For example, CR or LF will cause the call to fail,
84single '%' characters will cause the text to be ignored
85(if there really should be a '%' in the string,
86use '%%' 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>
90and
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
94for the message, the custom reply is not used.
95<li>Similarly, if the reply code (rcode) given is a '5XX' code but
96SMFI_TEMPFAIL is used for the message, the custom reply is not used.
97<BR>
98Note: in neither of the last two cases an error is returned to the milter,
99libmilter silently ignores the reply code.
100<li>
101If the milter returns SMFI_TEMPFAIL
102and sets the reply code to '421',
103then the SMTP server will terminate the SMTP session with a 421
104error code.
105</ul>
106</td>
107</tr>
108
109</table>
110
111<hr size="1">
112<font size="-1">
113Copyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
114All rights reserved.
115<br>
116By using this file, you agree to the terms and conditions set
117forth in the LICENSE.
118</font>
119</body>
120</html>
121