sendmail: Update vendor branch to v8.14.4
[dragonfly.git] / contrib / sendmail-8.14 / libmilter / docs / smfi_chgheader.html
blob517b5ba4c1c88ee88aca59cad3c386a86950276c
1 <HTML>
2 <HEAD><TITLE>smfi_chgheader</TITLE></HEAD>
3 <BODY>
4 <!--
5 $Id: smfi_chgheader.html,v 1.18 2009/05/18 23:51:23 ca Exp $
6 -->
7 <H1>smfi_chgheader</H1>
9 <TABLE border="0" cellspacing=4 cellpadding=4>
10 <!---------- Synopsis ----------->
11 <TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
12 <PRE>
13 #include &lt;libmilter/mfapi.h&gt;
14 int smfi_chgheader(
15 SMFICTX *ctx,
16 char *headerf,
17 mi_int32 hdridx,
18 char *headerv
20 </PRE>
21 Change or delete a message header.
22 </TD></TR>
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>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.</TD>
30 </TR>
31 <TR align="left" valign=top>
32 <TH width="80">Effects</TH>
33 <TD>Changes a header's value for the current message.</TD>
34 </TR>
35 </TABLE>
37 <!----------- Arguments ---------->
38 <TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
39 <TABLE border="1" cellspacing=0>
40 <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
41 <TR valign="top"><TD>ctx</TD>
42 <TD>Opaque context structure.
43 </TD></TR>
44 <TR valign="top"><TD>headerf</TD>
45 <TD>The header name, a non-NULL, null-terminated string.
46 </TD></TR>
47 <TR valign="top"><TD>hdridx</TD>
48 <TD>Header index value (1-based). A hdridx value of 1 will modify the first occurrence of a header named headerf. If hdridx is greater than the number of times headerf appears, a new copy of headerf will be added.
49 </TD></TR>
50 <TR valign="top"><TD>headerv</TD>
51 <TD>The new value of the given header. headerv == NULL implies that the header should be deleted.
52 </TD></TR>
53 </TABLE>
54 </TD></TR>
56 <!----------- Return values ---------->
57 <TR>
58 <TH valign="top" align=left>RETURN VALUES</TH>
60 <TD>
61 smfi_chgheader will return MI_FAILURE if
62 <UL><LI>headerf is NULL
63 <LI>Modifying headers in the current connection state is invalid.
64 <LI>Memory allocation fails.
65 <LI>A network error occurs.
66 <LI>SMFIF_CHGHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called.
67 </UL>
68 Otherwise, it returns MI_SUCCESS.
69 </TR>
71 <!----------- Notes ---------->
72 <TR align="left" valign=top>
73 <TH>NOTES</TH>
74 <TD>
75 <UL><LI>While smfi_chgheader may be used to add new headers, it is more efficient and far safer to use <A href="smfi_addheader.html">smfi_addheader</A>.
76 <LI>A filter which calls smfi_chgheader must have set the SMFIF_CHGHDRS flag in the smfiDesc_str passed to <A href="smfi_register.html">smfi_register</A>.
77 <LI>For smfi_chgheader, filter order is important. <B>Later filters will see the header changes made by earlier ones.</B>
78 <LI>Neither the name nor the value of the header is checked for
79 standards compliance. However, each line of the header must be under
80 2048 characters and should be under 998 characters. If longer headers
81 are needed, make them multi-line. To make a multi-line header, insert
82 a line feed (ASCII 0x0a, or <TT>\n</TT> in C) followed by at least
83 one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
84 or <TT>\t</TT> in C). The line feed should NOT be preceded by a
85 carriage return (ASCII 0x0d); the MTA will add this automatically.
86 <B>It is the filter writer's responsibility to ensure that no standards
87 are violated.</B>
88 <LI>The MTA adds a leading space to a header value unless
89 the flag
90 <A HREF="xxfi_negotiate.html#SMFIP_HDR_LEADSPC"><CODE>SMFIP_HDR_LEADSPC</CODE></A>
91 is set, in which case the milter
92 must include any desired leading spaces itself.
93 </UL>
94 </TD>
95 </TR>
97 <!----------- Example code ---------->
98 <TR>
99 <TH valign="top" align=left>EXAMPLE</TH>
101 <TD>
102 <PRE>
103 int ret;
104 SMFICTX *ctx;
108 ret = smfi_chgheader(ctx, "Content-Type", 1,
109 "multipart/mixed;\n\tboundary=\"foobar\"");
110 </PRE>
111 </TD>
112 </TR>
114 </TABLE>
116 <HR size="1">
117 <FONT size="-1">
118 Copyright (c) 2000-2003, 2009 Sendmail, Inc. and its suppliers.
119 All rights reserved.
120 <BR>
121 By using this file, you agree to the terms and conditions set
122 forth in the LICENSE.
123 </FONT>
124 </BODY>
125 </HTML>