smfi_chgheader.3n (2010 09)
s
smfi_chgheader(3N) smfi_chgheader(3N)
NAME
smfi_chgheader() - changes or deletes a sendmail message header
SYNOPSIS
#include <libmilter/mfapi.h>
int smfi_chgheader(
SMFICTX *ctx,
char *headerf ,
mi_int32 hdridx,
char *headerv
);
PARAMETERS
ctx Specifies the opaque context structure.
headerf Specifies the header name, which is 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.Ifhdridx is greater than the number of times
headerf appears,
a new copy of
headerf is added.
DESCRIPTION
smfi_chgheader()
changes the value of a header for the current message. smfi_chgheader()
can be called only from the xxfi_eom() routine.
Notes
• While
smfi_chgheader()
can be used to add new headers, it is more efficient to use
smfi_addheader().
• A filter that calls
smfi_chgheader()
must set the SMFIF_CHGHDRS flag in the smfiDesc_str
structure passed to smfi_register()
.
• The filter order is important for
smfi_chgheader()
. Filter placed later in the sequence will
observer the changes already done by earlier filters.
• The name and the value of the header are not checked for standards compliance. However, each line
of the header must be under 2048 characters. If longer headers are needed, multi-line header must be
used. To make a multi-line header, insert a linefeed (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 linefeed
must not be preceded by a carriage return (ASCII 0x0d); the MTA adds this automatically. It is the
responsibility of the filter writer to ensure that standards are not violated.
RETURN VALUE
smfi_chgheader()
returns MI_FAILURE due to the following reasons:
• headerf contains a NULL value.
• Modifying headers in the current connection state is invalid.
• Memory allocation fails.
• Network error occurs.
•
SMFIF_CHGHDRS is not set when smfi_register() is called.
smfi_chgheader() returns MI_SUCCESS on success.
EXAMPLES
int ret;
SMFICTX *ctx;
...
ret = smfi_chgheader(ctx, "Content-Type", 1,
"multipart/mixed;\n\tboundary=’foobar’");
AUTHOR
smfi_chgheader() was developed by the Sendmail Inc.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1