1168515Sgshapiro<HTML>
2168515Sgshapiro<HEAD><TITLE>smfi_setmlreply</TITLE></HEAD>
3168515Sgshapiro<BODY>
4132943Sgshapiro<!--
5266692Sgshapiro$Id: smfi_setmlreply.html,v 1.5 2013-11-22 20:51:39 ca Exp $
6132943Sgshapiro-->
7168515Sgshapiro<H1>smfi_setmlreply</H1>
8132943Sgshapiro
9168515Sgshapiro<TABLE border="0" cellspacing=4 cellpadding=4>
10132943Sgshapiro<!---------- Synopsis ----------->
11168515Sgshapiro<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
12168515Sgshapiro<PRE>
13132943Sgshapiro#include &lt;libmilter/mfapi.h&gt;
14132943Sgshapiroint smfi_setmlreply(
15132943Sgshapiro	SMFICTX *ctx,
16132943Sgshapiro	char *rcode,
17132943Sgshapiro	char *xcode,
18132943Sgshapiro	...
19132943Sgshapiro);
20168515Sgshapiro</PRE>
21132943SgshapiroSet the default SMTP error reply code to a multi-line response.  Only 4XX
22132943Sgshapiroand 5XX replies are accepted.
23168515Sgshapiro</TD></TR>
24132943Sgshapiro
25132943Sgshapiro<!----------- Description ---------->
26168515Sgshapiro<TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
27168515Sgshapiro<TABLE border="1" cellspacing=1 cellpadding=4>
28168515Sgshapiro<TR align="left" valign=top>
29168515Sgshapiro<TH width="80">Called When</TH>
30168515Sgshapiro<TD>smfi_setmlreply may be called from any of the xxfi_ callbacks
31168515Sgshapiroother than xxfi_connect.</TD>
32168515Sgshapiro</TR>
33168515Sgshapiro<TR align="left" valign=top>
34168515Sgshapiro<TH width="80">Effects</TH>
35168515Sgshapiro<TD>Directly set the SMTP error reply code for this connection to the given
36132943Sgshapirolines after the xcode.  The list of arguments must be NULL terminated.
37132943SgshapiroThis code  will be used on subsequent error replies resulting from actions
38168515Sgshapirotaken by this filter.</TD>
39168515Sgshapiro</TR>
40168515Sgshapiro</TABLE>
41132943Sgshapiro
42132943Sgshapiro<!----------- Arguments ---------->
43168515Sgshapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
44168515Sgshapiro    <TABLE border="1" cellspacing=0>
45168515Sgshapiro    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
46168515Sgshapiro    <TR valign="top"><TD>ctx</TD>
47168515Sgshapiro	<TD>Opaque context structure.
48168515Sgshapiro	</TD></TR>
49168515Sgshapiro    <TR valign="top"><TD>rcode</TD>
50168515Sgshapiro	<TD>The three-digit (RFC 821/2821) SMTP reply code, as a
51132943Sgshapiro	null-terminated string.  rcode cannot be NULL, and must be a valid
52132943Sgshapiro	4XX or 5XX reply code.
53168515Sgshapiro        </TD></TR>
54168515Sgshapiro    <TR valign="top"><TD>xcode</TD>
55168515Sgshapiro	<TD>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
56132943Sgshapiro	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
57168515Sgshapiro	</TD></TR>
58168515Sgshapiro    <TR valign="top"><TD>...</TD>
59168515Sgshapiro	<TD>The remainder of the arguments are single lines of text, up to
60132943Sgshapiro	32 arguments, which will be used as the text part of the SMTP
61132943Sgshapiro	reply.  The list must be NULL terminated.
62168515Sgshapiro	</TD></TR>
63168515Sgshapiro    </TABLE>
64168515Sgshapiro</TD></TR>
65132943Sgshapiro
66132943Sgshapiro<!----------- Example ---------->
67168515Sgshapiro<TR>
68168515Sgshapiro<TH valign="top" align=left>RETURN VALUES</TH> 
69168515Sgshapiro<TD>
70132943SgshapiroFor example, the code:<BR>
71168515Sgshapiro<PRE>
72132943Sgshapiro	ret = smfi_setmlreply(ctx, "550", "5.7.0",
73132943Sgshapiro			      "Spammer access rejected",
74132943Sgshapiro			      "Please see our policy at:",
75132943Sgshapiro			      "http://www.example.com/spampolicy.html",
76132943Sgshapiro			      NULL);
77168515Sgshapiro</PRE>
78132943Sgshapiro<BR>would give the SMTP response:<BR>
79168515Sgshapiro<PRE>
80132943Sgshapiro550-5.7.0 Spammer access rejected
81132943Sgshapiro550-5.7.0 Please see our policy at:
82132943Sgshapiro550 5.7.0 http://www.example.com/spampolicy.html
83168515Sgshapiro</PRE>
84168515Sgshapiro</TD>
85168515Sgshapiro</TR>
86132943Sgshapiro
87132943Sgshapiro<!----------- Return values ---------->
88168515Sgshapiro<TR>
89168515Sgshapiro<TH valign="top" align=left>RETURN VALUES</TH> 
90132943Sgshapiro
91168515Sgshapiro<TD>smfi_setmlreply will fail and return MI_FAILURE if:
92168515Sgshapiro<UL>
93168515Sgshapiro    <LI>The rcode or xcode argument is invalid.
94168515Sgshapiro    <LI>A memory-allocation failure occurs.
95168515Sgshapiro    <LI>If any text line contains a carraige return or line feed.
96168515Sgshapiro    <LI>The length of any text line is more than MAXREPLYLEN (980).
97168515Sgshapiro    <LI>More than 32 lines of text replies are given.
98168515Sgshapiro</UL>
99132943SgshapiroOtherwise, it return MI_SUCCESS.
100168515Sgshapiro</TD>
101168515Sgshapiro</TR>
102132943Sgshapiro
103132943Sgshapiro<!----------- Notes ---------->
104168515Sgshapiro<TR align="left" valign=top>
105168515Sgshapiro<TH>NOTES</TH> 
106168515Sgshapiro<TD>
107168515Sgshapiro<UL>
108168515Sgshapiro<LI>Values passed to smfi_setmlreply are not checked for standards compliance.
109168515Sgshapiro<LI>The message parameter should contain only printable characters,
110132943Sgshapiroother characters may lead to undefined behavior.
111132943SgshapiroFor example, CR or LF will cause the call to fail,
112132943Sgshapirosingle '%' characters will cause the text to be ignored
113132943Sgshapiro(if there really should be a '%' in the string,
114168515Sgshapirouse '%%' just like for <TT>printf(3)</TT>).
115168515Sgshapiro<LI>For details about reply codes and their meanings, please see RFC's 
116168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/
117168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A>
118132943Sgshapiroand
119168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/
120168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>.
121168515Sgshapiro<LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
122132943Sgshapirofor the message, the custom reply is not used.
123168515Sgshapiro<LI>Similarly, if the reply code (rcode) given is a '5XX' code but
124132943SgshapiroSMFI_TEMPFAIL is used for the message, the custom reply is not used.
125132943Sgshapiro<BR>
126132943SgshapiroNote: in neither of the last two cases an error is returned to the milter,
127132943Sgshapirolibmilter silently ignores the reply code.
128168515Sgshapiro<LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
129168515Sgshapirothen the SMTP server will terminate the SMTP session with a 421 error code.
130168515Sgshapiro</UL>
131168515Sgshapiro</TD>
132168515Sgshapiro</TR>
133132943Sgshapiro
134168515Sgshapiro</TABLE>
135132943Sgshapiro
136168515Sgshapiro<HR size="1">
137168515Sgshapiro<FONT size="-1">
138261363SgshapiroCopyright (c) 2000, 2002-2003 Proofpoint, Inc. and its suppliers.
139132943SgshapiroAll rights reserved.
140168515Sgshapiro<BR>
141132943SgshapiroBy using this file, you agree to the terms and conditions set
142132943Sgshapiroforth in the LICENSE.
143168515Sgshapiro</FONT>
144168515Sgshapiro</BODY>
145168515Sgshapiro</HTML>
146