1168515Sgshapiro<HTML>
2168515Sgshapiro<HEAD><TITLE>smfi_setmlreply</TITLE></HEAD>
3168515Sgshapiro<BODY>
4132943Sgshapiro<!--
5266527Sgshapiro$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>
41363466Sgshapiro</TD></TR>
42132943Sgshapiro
43132943Sgshapiro<!----------- Arguments ---------->
44168515Sgshapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
45168515Sgshapiro    <TABLE border="1" cellspacing=0>
46168515Sgshapiro    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
47168515Sgshapiro    <TR valign="top"><TD>ctx</TD>
48168515Sgshapiro	<TD>Opaque context structure.
49168515Sgshapiro	</TD></TR>
50168515Sgshapiro    <TR valign="top"><TD>rcode</TD>
51168515Sgshapiro	<TD>The three-digit (RFC 821/2821) SMTP reply code, as a
52132943Sgshapiro	null-terminated string.  rcode cannot be NULL, and must be a valid
53132943Sgshapiro	4XX or 5XX reply code.
54168515Sgshapiro        </TD></TR>
55168515Sgshapiro    <TR valign="top"><TD>xcode</TD>
56168515Sgshapiro	<TD>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
57132943Sgshapiro	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
58168515Sgshapiro	</TD></TR>
59168515Sgshapiro    <TR valign="top"><TD>...</TD>
60168515Sgshapiro	<TD>The remainder of the arguments are single lines of text, up to
61132943Sgshapiro	32 arguments, which will be used as the text part of the SMTP
62132943Sgshapiro	reply.  The list must be NULL terminated.
63168515Sgshapiro	</TD></TR>
64168515Sgshapiro    </TABLE>
65168515Sgshapiro</TD></TR>
66132943Sgshapiro
67132943Sgshapiro<!----------- Example ---------->
68168515Sgshapiro<TR>
69363466Sgshapiro<TH valign="top" align=left>RETURN VALUES</TH>
70168515Sgshapiro<TD>
71132943SgshapiroFor example, the code:<BR>
72168515Sgshapiro<PRE>
73132943Sgshapiro	ret = smfi_setmlreply(ctx, "550", "5.7.0",
74132943Sgshapiro			      "Spammer access rejected",
75132943Sgshapiro			      "Please see our policy at:",
76132943Sgshapiro			      "http://www.example.com/spampolicy.html",
77132943Sgshapiro			      NULL);
78168515Sgshapiro</PRE>
79132943Sgshapiro<BR>would give the SMTP response:<BR>
80168515Sgshapiro<PRE>
81132943Sgshapiro550-5.7.0 Spammer access rejected
82132943Sgshapiro550-5.7.0 Please see our policy at:
83132943Sgshapiro550 5.7.0 http://www.example.com/spampolicy.html
84168515Sgshapiro</PRE>
85168515Sgshapiro</TD>
86168515Sgshapiro</TR>
87132943Sgshapiro
88132943Sgshapiro<!----------- Return values ---------->
89168515Sgshapiro<TR>
90363466Sgshapiro<TH valign="top" align=left>RETURN VALUES</TH>
91132943Sgshapiro
92168515Sgshapiro<TD>smfi_setmlreply will fail and return MI_FAILURE if:
93168515Sgshapiro<UL>
94168515Sgshapiro    <LI>The rcode or xcode argument is invalid.
95168515Sgshapiro    <LI>A memory-allocation failure occurs.
96363466Sgshapiro    <LI>If any text line contains a carriage return or line feed.
97168515Sgshapiro    <LI>The length of any text line is more than MAXREPLYLEN (980).
98168515Sgshapiro    <LI>More than 32 lines of text replies are given.
99168515Sgshapiro</UL>
100132943SgshapiroOtherwise, it return MI_SUCCESS.
101168515Sgshapiro</TD>
102168515Sgshapiro</TR>
103132943Sgshapiro
104132943Sgshapiro<!----------- Notes ---------->
105168515Sgshapiro<TR align="left" valign=top>
106363466Sgshapiro<TH>NOTES</TH>
107168515Sgshapiro<TD>
108168515Sgshapiro<UL>
109168515Sgshapiro<LI>Values passed to smfi_setmlreply are not checked for standards compliance.
110168515Sgshapiro<LI>The message parameter should contain only printable characters,
111132943Sgshapiroother characters may lead to undefined behavior.
112132943SgshapiroFor example, CR or LF will cause the call to fail,
113132943Sgshapirosingle '%' characters will cause the text to be ignored
114132943Sgshapiro(if there really should be a '%' in the string,
115168515Sgshapirouse '%%' just like for <TT>printf(3)</TT>).
116363466Sgshapiro<LI>For details about reply codes and their meanings, please see RFC's
117168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/
118168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A>
119132943Sgshapiroand
120168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/
121168515Sgshapiro<A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>.
122168515Sgshapiro<LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
123132943Sgshapirofor the message, the custom reply is not used.
124168515Sgshapiro<LI>Similarly, if the reply code (rcode) given is a '5XX' code but
125132943SgshapiroSMFI_TEMPFAIL is used for the message, the custom reply is not used.
126132943Sgshapiro<BR>
127132943SgshapiroNote: in neither of the last two cases an error is returned to the milter,
128132943Sgshapirolibmilter silently ignores the reply code.
129168515Sgshapiro<LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
130168515Sgshapirothen the SMTP server will terminate the SMTP session with a 421 error code.
131168515Sgshapiro</UL>
132168515Sgshapiro</TD>
133168515Sgshapiro</TR>
134132943Sgshapiro
135168515Sgshapiro</TABLE>
136132943Sgshapiro
137168515Sgshapiro<HR size="1">
138168515Sgshapiro<FONT size="-1">
139261194SgshapiroCopyright (c) 2000, 2002-2003 Proofpoint, Inc. and its suppliers.
140132943SgshapiroAll rights reserved.
141168515Sgshapiro<BR>
142132943SgshapiroBy using this file, you agree to the terms and conditions set
143132943Sgshapiroforth in the LICENSE.
144168515Sgshapiro</FONT>
145168515Sgshapiro</BODY>
146168515Sgshapiro</HTML>
147