Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Milter APIs
Message Modification APIs
Chapter 2 29
smfi_chgheader() returns MI_SUCCESS on success.
Example
Following is an example of smfi_chgheader():
int ret;
SMFICTX *ctx;
...
ret = smfi_chgheader(ctx, "Content-Type", 1,
"multipart/mixed;\n\tboundary='foobar'");
The smfi_insheader() API
You can use the smfi_insheader() API to prepend a header to the
current message. You can call smfi_insheader() only from the
xxfi_eom() callback.
The declaration of smfi_insheader() is as follows:
#include <libmilter/mfapi.h>
int smfi_insheader(
SMFICTX *ctx,
int hdridx,
char *headerf,
char *headerv
);
Following are some points to consider regarding smfi_insheader():
• smfi_insheader() does not change the existing headers of a
message. To change the current value of a header, use the
smfi_chgheader() API.
• A filter application that calls the smfi_insheader() API must set
the SMFIF_ADDHDRS flag in smfiDesc_str passed to the
smfi_register() API.
•Forsmfi_insheader(), the order in which you place filter
applications is important. Filter applications placed later in the
sequence observe changes already done by earlier filter applications.
If the value of hdridx is larger than the number of headers in the
message, the header is simply appended. The filter application 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