# smfi_replacebody

SYNOPSIS

    #include <libmilter/mfapi.h>
    int smfi_replacebody(
    	SMFICTX *ctx,
    	unsigned char *bodyp,
    	int bodylen
    );

Replace message-body data.

DESCRIPTION

Called When | Called only from xxfi_eom. smfi_replacebody may be called more than once.
Effects | smfi_replacebody replaces the body of the current message. If called more than once, subsequent calls result in data being appended to the new body.

ARGUMENTS

Argument | Description
--- | ---
ctx | Opaque context structure.
bodyp | A pointer to the start of the new body data, which does not have to be null-terminated. If bodyp is NULL, it is treated as having length == 0. Body data should be in CR/LF form.
bodylen | The number of data bytes pointed to by bodyp.

RETURN VALUES

smfi_replacebody fails and returns MI_FAILURE if:

- bodyp == NULL and bodylen > 0.
- Changing the body in the current connection state is invalid.
- A network error occurs.
- SMFIF_CHGBODY was not set when smfi_register was called.

Otherwise, it will return MI_SUCCESS.

NOTES

- Since the message body may be very large, setting SMFIF_CHGBODY may significantly affect filter performance.
- If a filter sets SMFIF_CHGBODY but does not call smfi_replacebody, the original body remains unchanged.
- For smfi_replacebody, filter order is important. Later filters will see the new body contents created by earlier ones.

Copyright (c) 2000-2001, 2003 Sendmail, Inc. and its suppliers. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the LICENSE.