Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Milter APIs
Message Modification APIs
Chapter 2 27
• headerf or headerv value is NULL.
• Adding headers in the current connection state is invalid.
• Memory allocation fails.
• Network error occurs.
• SMFIF_ADDHDRS is not set when the smfi_register() API is called.
smfi_addheader() returns MI_SUCCESS on success.
Example
Following is an example for smfi_addheader():
int ret;
SMFICTX *ctx;
...
ret = smfi_addheader(ctx, "Content-Type",
"multipart/mixed;\n\tboundary='foobar'");
The smfi_chgheader() API
You can use the smfi_chgheader() API to change or delete a message
header. You can call smfi_chgheader() only from the xxfi_eom()
callback.
The declaration of smfi_chgheader() is as follows:
#include <libmilter/mfapi.h>
int smfi_chgheader(
SMFICTX *ctx,
char *headerf,
mi_int32 hdridx,
char *headerv
);
Following are some points to consider regarding smfi_chgheader():
• While you can use smfi_chgheader() to add new headers, it is
efficient to use the smfi_addheader() API.
• A filter program that calls the smfi_chgheader() API must set the
SMFIF_CHGHDRS flag in the smfiDesc_str passed to the
smfi_register() API.