smfi_setreply.html revision 125820
1117521Snjl<html>
2207344Sjkim<head><title>smfi_setreply</title></head>
3207344Sjkim<body>
4207344Sjkim<h1>smfi_setreply</h1>
5207344Sjkim
6207344Sjkim<table border="0" cellspacing=4 cellpadding=4>
7207344Sjkim<!---------- Synopsis ----------->
8207344Sjkim<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
9207344Sjkim<pre>
10207344Sjkim#include &lt;libmilter/mfapi.h&gt;
11207344Sjkimint smfi_setreply(
12207344Sjkim	SMFICTX *ctx,
13207344Sjkim	char *rcode,
14207344Sjkim	char *xcode,
15207344Sjkim	char *message
16207344Sjkim);
17207344Sjkim</pre>
18207344SjkimSet the default SMTP error reply code.  Only 4XX and 5XX replies are accepted.
19207344Sjkim</td></tr>
20207344Sjkim
21207344Sjkim<!----------- Description ---------->
22207344Sjkim<tr><th valign="top" align=left>DESCRIPTION</th><td>
23207344Sjkim<table border="1" cellspacing=1 cellpadding=4>
24207344Sjkim<tr align="left" valign=top>
25207344Sjkim<th width="80">Called When</th>
26207344Sjkim<td>smfi_setreply may be called from any of the xxfi_ callbacks
27207344Sjkimother than xxfi_connect.</td>
28207344Sjkim</tr>
29207344Sjkim<tr align="left" valign=top>
30207344Sjkim<th width="80">Effects</th>
31207344Sjkim<td>Directly set the SMTP error reply code for this connection.  This code 
32207344Sjkimwill be used on subsequent error replies resulting from actions taken by 
33207344Sjkimthis filter.</td>
34207344Sjkim</tr>
35207344Sjkim</table>
36207344Sjkim
37207344Sjkim<!----------- Arguments ---------->
38207344Sjkim<tr><th valign="top" align=left>ARGUMENTS</th><td>
39207344Sjkim    <table border="1" cellspacing=0>
40207344Sjkim    <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
41207344Sjkim    <tr valign="top"><td>ctx</td>
42207344Sjkim	<td>Opaque context structure.
43207344Sjkim	</td></tr>
44207344Sjkim    <tr valign="top"><td>rcode</td>
45207344Sjkim	<td>The three-digit (RFC 821/2821) SMTP reply code, as a
46207344Sjkim	null-terminated string.  rcode cannot be NULL, and must be a valid
47207344Sjkim	4XX or 5XX reply code.
48207344Sjkim        </td></tr>
49207344Sjkim    <tr valign="top"><td>xcode</td>
50207344Sjkim	<td>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
51207344Sjkim	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
52207344Sjkim	</td></tr>
53207344Sjkim    <tr valign="top"><td>message</td>
54207344Sjkim	<td>The text part of the SMTP reply.  If message is NULL, an empty message is used.
55207344Sjkim	</td></tr>
56207344Sjkim    </table>
57207344Sjkim</td></tr>
58207344Sjkim
59207344Sjkim<!----------- Return values ---------->
60207344Sjkim<tr>
61207344Sjkim<th valign="top" align=left>RETURN VALUES</th> 
62207344Sjkim
63207344Sjkim<td>smfi_setreply will fail and return MI_FAILURE if:
64207344Sjkim<ul>
65207344Sjkim    <li>The rcode or xcode argument is invalid.
66207344Sjkim    <li>A memory-allocation failure occurs.
67207344Sjkim</ul>
68206117SjkimOtherwise, it return MI_SUCCESS.
69206117Sjkim</td>
70206117Sjkim</tr>
71206117Sjkim
72206117Sjkim<!----------- Notes ---------->
73206117Sjkim<tr align="left" valign=top>
74206117Sjkim<th>NOTES</th> 
75206117Sjkim<td>
76206117Sjkim<ul>
77206117Sjkim<li>Values passed to smfi_setreply are not checked for standards compliance.
78206117Sjkim<li>The message parameter should contain only printable characters,
79206117Sjkimother characters may lead to undefined behavior.
80206117SjkimFor example, CR or LF will cause the call to fail,
81206117Sjkimsingle '%' characters will cause the text to be ignored
82206117Sjkim(if there really should be a '%' in the string,
83206117Sjkimuse '%%' just like for <tt>printf(3)</tt>).
84206117Sjkim<li>For details about reply codes and their meanings, please see RFC's 
85206117Sjkim<a href="http://www.rfc-editor.org/rfc/rfc821.txt">821</a>/
86206117Sjkim<a href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</a>
87206117Sjkimand
88206117Sjkim<a href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</a>/
89206117Sjkim<a href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</a>.
90206117Sjkim<li>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
91206117Sjkimfor the message, the custom reply is not used.
92206117Sjkim<li>Similarly, if the reply code (rcode) given is a '5XX' code but
93206117SjkimSMFI_TEMPFAIL is used for the message, the custom reply is not used.
94206117Sjkim</ul>
95206117Sjkim</td>
96206117Sjkim</tr>
97206117Sjkim
98206117Sjkim</table>
99206117Sjkim
100206117Sjkim<hr size="1">
101206117Sjkim<font size="-1">
102206117SjkimCopyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
103206117SjkimAll rights reserved.
104206117Sjkim<br>
105206117SjkimBy using this file, you agree to the terms and conditions set
106206117Sjkimforth in the LICENSE.
107206117Sjkim</font>
108206117Sjkim</body>
109206117Sjkim</html>
110206117Sjkim