Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Milter APIs
Message Modification APIs
Chapter 2 25
Message Modification APIs
The message modification APIs change the contents and attributes of a
message. These APIs include additional communication with the MTA
and return either MI_SUCCESS or MI_FAILURE to indicate the status of
the operation. You can call these APIs only in the xxfi_eom() callback.
A filter program must set the appropriate flag in the description passed
to the smfi_register() API to call any message modification function.
The MTA treats a call to the function as a failure of the filter program
and terminates its connection when a filter program does not set the
appropriate flag.
The status returned indicates only whether the message of the filter was
successfully sent to the MTA and does not indicate whether the MTA has
performed the requested operation. For example, when the
smfi_addheader() API is called with an illegal header name,
smfi_addheader() returns MI_SUCCESS even though the MTA can later
refuse to add the illegal header.
Following are the message modification APIs:
• smfi_addheader()
• smfi_chgheader()
• smfi_insheader()
• smfi_addrcpt()
• smfi_delrcpt()
• smfi_replacebody()
• Other message modification APIs
The following sections discuss the message modification APIs in detail.
The smfi_addheader() API
You can use the smfi_addheader() API to add a header to the current
message. You can call smfi_addheader() only from the xxfi_eom()
callback.
The declaration for smfi_addheader() is as follows:
#include <libmilter/mfapi.h>