1<HTML> 2<HEAD><TITLE>smfi_addheader</TITLE></HEAD> 3<BODY> 4<!-- 5$Id: smfi_addheader.html,v 1.19 2006/12/21 18:30:35 ca Exp $ 6--> 7<H1>smfi_addheader</H1> 8 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 <libmilter/mfapi.h> 14int smfi_addheader( 15 SMFICTX *ctx, 16 char *headerf, 17 char *headerv 18); 19</PRE> 20Add a header to the current message. 21</TD></TR> 22 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> 29</TR> 30<TR align="left" valign=top> 31<TH width="80">Effects</TH> 32<TD>Adds a header to the current message.</TD> 33</TR> 34</TABLE> 35 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. 42 </TD></TR> 43 <TR valign="top"><TD>headerf</TD> 44 <TD>The header name, a non-NULL, null-terminated string. 45 </TD></TR> 46 <TR valign="top"><TD>headerv</TD> 47 <TD>The header value to be added, a non-NULL, null-terminated string. 48 This may be the empty string. 49 </TD></TR> 50 </TABLE> 51</TD></TR> 52 53<!----------- Return values ----------> 54<TR> 55<TH valign="top" align=left>RETURN VALUES</TH> 56 57<TD>smfi_addheader returns MI_FAILURE if: 58<UL><LI>headerf or headerv is NULL. 59 <LI>Adding headers in the current connection state is invalid. 60 <LI>Memory allocation fails. 61 <LI>A network error occurs. 62 <LI>SMFIF_ADDHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called. 63</UL> 64Otherwise, it returns MI_SUCCESS. 65</TD> 66</TR> 67 68<!----------- Notes ----------> 69<TR align="left" valign=top> 70<TH>NOTES</TH> 71<TD> 72<UL><LI>smfi_addheader does not change a message's existing headers. 73To change a header's current value, use 74<A HREF="smfi_chgheader.html">smfi_chgheader</A>. 75 <LI>A filter which calls smfi_addheader must have set the SMFIF_ADDHDRS 76 flag in the smfiDesc_str passed to 77 <A href="smfi_register.html">smfi_register</A>. 78 <LI>For smfi_addheader, filter order is important. 79 <B>Later filters will see the header changes made by earlier ones.</B> 80 <LI>Neither the name nor the value of the header is checked for 81 standards compliance. 82 However, each line of the header must be under 2048 characters 83 and should be under 998 characters. 84 If longer headers are needed, make them multi-line. 85 To make a multi-line header, 86 insert a line feed (ASCII 0x0a, or <TT>\n</TT> in C) 87 followed by at least one whitespace character 88 such as a space (ASCII 0x20) or tab (ASCII 0x09, or <TT>\t</TT> in C). 89 The line feed should NOT be preceded by a carriage return (ASCII 0x0d); 90 the MTA will add this automatically. 91 <B>It is the filter writer's responsibility to ensure that no standards 92 are violated.</B> 93 <LI>The MTA adds a leading space to an added header value. 94</UL> 95</TD> 96</TR> 97 98<!----------- Example code ----------> 99<TR> 100<TH valign="top" align=left>EXAMPLE</TH> 101 102<TD> 103 <PRE> 104 int ret; 105 SMFICTX *ctx; 106 107 ... 108 109 ret = smfi_addheader(ctx, "Content-Type", 110 "multipart/mixed;\n\tboundary=\"foobar\""); 111 </PRE> 112</TD> 113</TR> 114 115</TABLE> 116 117<HR size="1"> 118<FONT size="-1"> 119Copyright (c) 2000-2003, 2006 Sendmail, Inc. and its suppliers. 120All rights reserved. 121<BR> 122By using this file, you agree to the terms and conditions set 123forth in the LICENSE. 124</FONT> 125</BODY> 126</HTML> 127