Change or delete a message header.
||Called only from xxfi_eom.
||Changes a header's value for the current message.
||Opaque context structure.
||The header name, a non-NULL, null-terminated string.
||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.
||The new value of the given header. headerv == NULL implies that the header should be deleted.
smfi_chgheader will return MI_FAILURE if
Otherwise, it returns MI_SUCCESS.
- headerf is NULL
- Modifying headers in the current connection state is invalid.
- Memory allocation fails.
- A network error occurs.
- SMFIF_CHGHDRS was not set when smfi_register was called.
- While smfi_chgheader may be used to add new headers, it is more efficient and far safer to use smfi_addheader.
- A filter which calls smfi_chgheader must have set the SMFIF_CHGHDRS flag in the smfiDesc_str passed to smfi_register.
- For smfi_chgheader, filter order is important. Later filters will see the header changes made by earlier ones.
- Neither the name nor the value of the header is checked for
standards compliance. However, each line of the header must be under
2048 characters and should be under 998 characters. If longer headers
are needed, make them multi-line. To make a multi-line header, insert
a line feed (ASCII 0x0a, or \n in C) followed by at least
one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
or \t in C). The line feed should NOT be preceded by a
carriage return (ASCII 0x0d); the MTA will add this automatically.
It is the filter writer's responsibility to ensure that no standards
- The MTA adds a leading space to a header value unless
is set, in which case the milter
must include any desired leading spaces itself.
ret = smfi_chgheader(ctx, "Content-Type", 1,