Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Milter APIs
Message Modification APIs
Chapter 228
• The filter order is important for the smfi_chgheader() API. A filter
application placed later in the sequence observes the changes
already done by earlier filters.
• The filter program does not check the name and the value of the
header for standards compliance. However, each line of the header
must be less than 2048 characters. If you require longer headers, use
multiline headers. To make a multiline header, insert a LF (ASCII
0x0 character or \n in C language) followed by at least a white space
character, such as a space (ASCII 9x20) or a tab (ASCII 0x09 or \t in
C language) character.
You must precede the LF with a CR (ASCII 0x0d character) because
the MTA adds the CR automatically. You must ensure that you do
not violate any standards.
Arguments
You must call smfi_chgheader() with the following arguments:
ctx Specifies an opaque context structure.
headerf Specifies the header name, which is a a non-NULL,
null-terminated string.
hdridx Specifies the header index value (1-based). A hdridx
value of 1 modifies the first occurrence of a header
named headerf. If hdridx is greater than the number
of occurrences of headerf, a new copy of headerf is
added.
headerv Specifies the new value of the given header. A value of
NULL to headerv implies that you must delete the
header.
Return Values
smfi_chgheader() fails because of the following reasons and returns
MI_FAILURE:
• headerf is NULL.
• Modifying headers in the current connection state is invalid.
• Memory allocation failure.
• Network error occurs.
• SMFIF_CHGHDRS is not set when smfi_register() is called.