1<html> 2<head><title>smfi_addheader</title></head> 3<body> 4<h1>smfi_addheader</h1> 5 6<table border="0" cellspacing=4 cellpadding=4> 7<!---------- Synopsis -----------> 8<tr><th valign="top" align=left width=150>SYNOPSIS</th><td> 9<pre> 10#include <libmilter/mfapi.h> 11int smfi_addheader( 12 SMFICTX *ctx, 13 char *headerf, 14 char *headerv 15); 16</pre> 17Add a header to the current message. 18</td></tr> 19 20<!----------- Description ----------> 21<tr><th valign="top" align=left>DESCRIPTION</th><td> 22<table border="1" cellspacing=1 cellpadding=4> 23<tr align="left" valign=top> 24<th width="80">Called When</th> 25<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td> 26</tr> 27<tr align="left" valign=top> 28<th width="80">Effects</th> 29<td>Adds a header to the current message.</td> 30</tr> 31</table> 32 33<!----------- Arguments ----------> 34<tr><th valign="top" align=left>ARGUMENTS</th><td> 35 <table border="1" cellspacing=0> 36 <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr> 37 <tr valign="top"><td>ctx</td> 38 <td>Opaque context structure. 39 </td></tr> 40 <tr valign="top"><td>headerf</td> 41 <td>The header name, a non-NULL, null-terminated string. 42 </td></tr> 43 <tr valign="top"><td>headerv</td> 44 <td>The header value to be added, a non-NULL, null-terminated string. This may be the empty string. 45 </td></tr> 46 </table> 47</td></tr> 48 49<!----------- Return values ----------> 50<tr> 51<th valign="top" align=left>RETURN VALUES</th> 52 53<td>smfi_addheader returns MI_FAILURE if: 54<ul><li>headerf or headerv is NULL. 55 <li>Adding headers in the current connection state is invalid. 56 <li>Memory allocation fails. 57 <li>A network error occurs. 58 <li>SMFIF_ADDHDRS was not set when <a href="smfi_register.html">smfi_register</a> was called. 59</ul> 60Otherwise, it returns MI_SUCCESS. 61</td> 62</tr> 63 64<!----------- Notes ----------> 65<tr align="left" valign=top> 66<th>NOTES</th> 67<td> 68<ul><li>smfi_addheader does not change a message's existing headers. 69To change a header's current value, use <a 70href="smfi_chgheader.html">smfi_chgheader</a>. 71 <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>. 72 <li>For smfi_chgheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b> 73 <li>Neither the name nor the value of the header is checked for 74 standards compliance. However, each line of the header must be under 75 2048 characters and should be under 998 characters. If longer headers 76 are needed, make them multi-line. To make a multi-line header, insert 77 a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least 78 one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09, 79 or <tt>\t</tt> in C). The line feed should NOT be preceded by a 80 carriage return (ASCII 0x0d); the MTA will add this automatically. 81 <b>It is the filter writer's responsibility to ensure that no standards 82 are violated.</b> 83</ul> 84</td> 85</tr> 86 87<!----------- Example code ----------> 88<tr> 89<th valign="top" align=left>EXAMPLE</th> 90 91<td> 92 <pre> 93 int ret; 94 SMFICTX *ctx; 95 96 ... 97 98 ret = smfi_addheader(ctx, "Content-Type", 99 "multipart/mixed;\n\tboundary=\"foobar\""); 100 </pre> 101</td> 102</tr> 103 104</table> 105 106<hr size="1"> 107<font size="-1"> 108Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers. 109All rights reserved. 110<br> 111By using this file, you agree to the terms and conditions set 112forth in the LICENSE. 113</font> 114</body> 115</html> 116