# 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 CRLF 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 is not set.

Otherwise, it will return MI_SUCCESS.

NOTES

- Since the message body may be very large, calling smfi_replacebody 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.
- A filter which calls smfi_replacebody must have set the SMFIF_CHGBODY flag.

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