2 <head><title>smfi_addheader</title></head>
5 $Id: smfi_addheader.html,v 1.15 2004/05/04 17:55:50 ca Exp $
7 <h1>smfi_addheader</h1>
9 <table border="0" cellspacing=4 cellpadding=4>
10 <!---------- Synopsis ----------->
11 <tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
13 #include <libmilter/mfapi.h>
20 Add a header to the current message.
23 <!----------- Description ---------->
24 <tr><th valign="top" align=left>DESCRIPTION</th><td>
25 <table border="1" cellspacing=1 cellpadding=4>
26 <tr align="left" valign=top>
27 <th width="80">Called When</th>
28 <td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td>
30 <tr align="left" valign=top>
31 <th width="80">Effects</th>
32 <td>Adds a header to the current message.</td>
36 <!----------- Arguments ---------->
37 <tr><th valign="top" align=left>ARGUMENTS</th><td>
38 <table border="1" cellspacing=0>
39 <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
40 <tr valign="top"><td>ctx</td>
41 <td>Opaque context structure.
43 <tr valign="top"><td>headerf</td>
44 <td>The header name, a non-NULL, null-terminated string.
46 <tr valign="top"><td>headerv</td>
47 <td>The header value to be added, a non-NULL, null-terminated string. This may be the empty string.
52 <!----------- Return values ---------->
54 <th valign="top" align=left>RETURN VALUES</th>
56 <td>smfi_addheader returns MI_FAILURE if:
57 <ul><li>headerf or headerv is NULL.
58 <li>Adding headers in the current connection state is invalid.
59 <li>Memory allocation fails.
60 <li>A network error occurs.
61 <li>SMFIF_ADDHDRS was not set when <a href="smfi_register.html">smfi_register</a> was called.
63 Otherwise, it returns MI_SUCCESS.
67 <!----------- Notes ---------->
68 <tr align="left" valign=top>
71 <ul><li>smfi_addheader does not change a message's existing headers.
72 To change a header's current value, use <a
73 href="smfi_chgheader.html">smfi_chgheader</a>.
74 <li>A filter which calls smfi_addheader must have set the SMFIF_ADDHDRS flag in the smfiDesc_str passed to <a href="smfi_register.html">smfi_register</a>.
75 <li>For smfi_addheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b>
76 <li>Neither the name nor the value of the header is checked for
77 standards compliance. However, each line of the header must be under
78 2048 characters and should be under 998 characters. If longer headers
79 are needed, make them multi-line. To make a multi-line header, insert
80 a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least
81 one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
82 or <tt>\t</tt> in C). The line feed should NOT be preceded by a
83 carriage return (ASCII 0x0d); the MTA will add this automatically.
84 <b>It is the filter writer's responsibility to ensure that no standards
90 <!----------- Example code ---------->
92 <th valign="top" align=left>EXAMPLE</th>
101 ret = smfi_addheader(ctx, "Content-Type",
102 "multipart/mixed;\n\tboundary=\"foobar\"");
111 Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
114 By using this file, you agree to the terms and conditions set
115 forth in the LICENSE.