Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Milter APIs
Message Modification APIs
Chapter 2 33
#include <libmilter/mfapi.h>
int smfi_replacebody(
SMFICTX *ctx,
unsigned char *bodyp,
int bodylen
);
Following are some points to consider regarding smfi_replacebody():
• As the message body can be very large, setting SMFIF_CHGBODY can
significantly affect the performance of the filter program.
• If a filter program sets SMFIF_CHGBODY but does not call
smfi_replacebody(), the original body remains unchanged.
• The filter order is important for smfi_replacebody(). Filters placed
later in the sequence observe the changes created by earlier filters.
Arguments
You can call smfi_replacebody() with the following arguments:
ctx Specifies an opaque context structure.
bodyp Denotes a pointer to the start of the new body data,
which need not be null-terminated. If you set bodyp to
NULL, the length of the body is considered to be 0
(zero). The body data must be in CR or LF form.
bodylen Specifies the number of data bytes pointed by bodyp.
Return Values
smfi_replacebody() fails because of the following reasons and returns
MI_FAILURE:
• The value of bodyp is equal to NULL and the value of bodylen is
greater than 0.
• Changing the body in the current connection state is invalid.
• Network error occurs.
• The SMFIF_CHGBODY is not set when the smfi_register() routine is
called.