smfi_chgfrom Function

Purpose

The smfi_chgfrom function modifies the envelope sender (MAIL From) for the current message.

Syntax

#include <libmilter/mfapi.h>
int smfi_chgfrom(
SMFICTX *ctx,
const char *mail,
char *args
);

Description

The smfi_chgfrom function is called from the xxfi_eom function, to modify the envelope sender and the MAIL From of the current message.

A filter that calls the smfi_chgfrom function must set the SMFIF_CHGFROM flag in the smfiDesc_str argument. The filter then passes the value to the smfi_register function.

All extended simple mail transfer protocol (ESMTP) arguments can be set through the call. But, setting values for some of the arguments like SIZE and BODY are causing problems. Hence, proper care must be taken when setting the arguments. There is no feedback from mail transfer agent (MTA) to the milter parameter if the call is successful.

Arguments

Table 1. Arguments
Item Description
ctx The opaque context structure is maintained in the libmilter parameter.
mail The new sender address.
args Extended simple mail transfer protocol (ESMTP) arguments.

Return values

The smfi_chgfrom function returns the MI_FAILURE value in the following cases. Otherwise, the function returns MI_SUCCESS.
  • The mail argument is NULL.
  • Changing the sender in the current connection state is invalid.
  • A network error occurs.
  • The SMFIF_CHGFROM flag was not set when smfi_register function was called.

Related information

libmilter_xxfi_eom.html

libmilter_smfi_register.html