smfi_setreply.html revision 168516
18870Srgrimes<HTML>
250476Speter<HEAD><TITLE>smfi_setreply</TITLE></HEAD>
38870Srgrimes<BODY>
42116Sjkh<!--
52116Sjkh$Id: smfi_setreply.html,v 1.17 2006/12/21 18:30:35 ca Exp $
68870Srgrimes-->
72116Sjkh<H1>smfi_setreply</H1>
82116Sjkh
98870Srgrimes<TABLE border="0" cellspacing=4 cellpadding=4>
102116Sjkh<!---------- Synopsis ----------->
112116Sjkh<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
128870Srgrimes<PRE>
138870Srgrimes#include &lt;libmilter/mfapi.h&gt;
142116Sjkhint smfi_setreply(
15212518Simp	SMFICTX *ctx,
16131001Smarcel	char *rcode,
17141281Sdas	char *xcode,
18212518Simp	char *message
1933662Sjb);
202116Sjkh</PRE>
21141281SdasSet the default SMTP error reply code.  Only 4XX and 5XX replies are accepted.
22130149Sdas</TD></TR>
23180581Sdas
242116Sjkh<!----------- Description ---------->
25174684Sdas<TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
26174684Sdas<TABLE border="1" cellspacing=1 cellpadding=4>
27174684Sdas<TR align="left" valign=top>
28181074Sdas<TH width="80">Called When</TH>
29174684Sdas<TD>smfi_setreply may be called from any of the xxfi_ callbacks
30174684Sdasother than xxfi_connect.</TD>
31181074Sdas</TR>
32174684Sdas<TR align="left" valign=top>
33174684Sdas<TH width="80">Effects</TH>
34180581Sdas<TD>Directly set the SMTP error reply code for this connection.  This code 
35180581Sdaswill be used on subsequent error replies resulting from actions taken by 
36180581Sdasthis filter.</TD>
37180581Sdas</TR>
382116Sjkh</TABLE>
39119017Sgordon
40169807Sdeischen<!----------- Arguments ---------->
41181064Sdas<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
4293211Sbde    <TABLE border="1" cellspacing=0>
4393211Sbde    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
442116Sjkh    <TR valign="top"><TD>ctx</TD>
452116Sjkh	<TD>Opaque context structure.
462116Sjkh	</TD></TR>
472116Sjkh    <TR valign="top"><TD>rcode</TD>
48216211Sdas	<TD>The three-digit (RFC 821/2821) SMTP reply code, as a
49216211Sdas	null-terminated string.  rcode cannot be NULL, and must be a valid
502116Sjkh	4XX or 5XX reply code.
51130149Sdas        </TD></TR>
52152133Sbde    <TR valign="top"><TD>xcode</TD>
53141280Sdas	<TD>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
54181074Sdas	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
55176243Sbde	</TD></TR>
56174617Sdas    <TR valign="top"><TD>message</TD>
57174617Sdas	<TD>The text part of the SMTP reply.  If message is NULL, an empty message is used.
58144650Sdas	</TD></TR>
59144650Sdas    </TABLE>
60176243Sbde</TD></TR>
61140609Sdas
62131320Sdas<!----------- Return values ---------->
63143222Sdas<TR>
64144772Sdas<TH valign="top" align=left>RETURN VALUES</TH> 
65140088Sdas
66144772Sdas<TD>smfi_setreply will fail and return MI_FAILURE if:
67174684Sdas<UL>
68144091Sdas    <LI>The rcode or xcode argument is invalid.
69144772Sdas    <LI>A memory-allocation failure occurs.
70132382Sdas</UL>
71176243SbdeOtherwise, it return MI_SUCCESS.
72176388Sdas</TD>
73141280Sdas</TR>
742116Sjkh
75121497Sdes<!----------- Notes ---------->
76121497Sdes<TR align="left" valign=top>
77211934Snwhitehorn<TH>NOTES</TH> 
78211934Snwhitehorn<TD>
79211934Snwhitehorn<UL>
80211934Snwhitehorn<LI>Values passed to smfi_setreply are not checked for standards compliance.
81211934Snwhitehorn<LI>The message parameter should contain only printable characters,
82176361Sdasother characters may lead to undefined behavior.
83211934SnwhitehornFor example, CR or LF will cause the call to fail,
84157196Sdeischensingle '%' characters will cause the text to be ignored
85121497Sdes(if there really should be a '%' in the string,
86157196Sdeischenuse '%%' just like for <TT>printf(3)</TT>).
87157196Sdeischen<LI>For details about reply codes and their meanings, please see RFC's 
88157196Sdeischen<A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/
89121497Sdes<A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A>
90175309Sdasand
91143222Sdas<A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/
92143222Sdas<A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>.
93181074Sdas<LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
94181074Sdasfor the message, the custom reply is not used.
95181074Sdas<LI>Similarly, if the reply code (rcode) given is a '5XX' code but
96181377SdasSMFI_TEMPFAIL is used for the message, the custom reply is not used.
97181377Sdas<BR>
98176361SdasNote: in neither of the last two cases an error is returned to the milter,
99177766Sdaslibmilter silently ignores the reply code.
100177766Sdas<LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
101143222Sdasthen the SMTP server will terminate the SMTP session with a 421 error code.
102121497Sdes</UL>
103129864Sstefanf</TD>
104129864Sstefanf</TR>
105181377Sdas
106129864Sstefanf</TABLE>
1072116Sjkh
1082116Sjkh<HR size="1">
1092116Sjkh<FONT size="-1">
110117912SpeterCopyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
111117912SpeterAll rights reserved.
1126953Sbde<BR>
113117912SpeterBy using this file, you agree to the terms and conditions set
1146953Sbdeforth in the LICENSE.
115117912Speter</FONT>
1166953Sbde</BODY>
117216137Sdas</HTML>
118216137Sdas