Milter smfi_chgfrom()

Change envelope sender with ESMTP arguments V8.14 and later

The smfi_chgfrom() Milter library routine is used to change the envelope sender address (the address given with the MAIL From: SMTP command). Recall that the envelope sender is the address to which bounced email will be sent, and might also be the address used for TLS authentication.

Before you can use this smfi_chfrom() routine, you must notify the Milter library that you intend to do so by adding the SMFIF_CHGFROM flag to the flags portion of the smfiDesc structure:

struct smfiDesc smfilter =
{
    ...
    SMFIF_CHGFROM,                  /* flags */
    ...

Failure to include this flag causes smfi_chgfrom() to return MI_FAILURE every time it is called.

This smfi_chfrom() routine may only be called from inside an xxfi_eom() function (Milter xxfi_eom() on page 1215) you write yourself. It is called like this:

ret = smfi_chfrom(ctx, addr, args);

Here, ctx is the common context pointer that was passed to your xxfi_eom() function. The addr is the email address of the sender which will replace the original sender. The additional args specifies any ESMTP envelope sender arguments you wish to add.

If addr is NULL, smfi_chgfrom() will return MI_FAILURE. Otherwise, the address you specify must be a legal email address of the form user, a literal @ character, and then a canonical hostname:

user@example.com

The addr may optionally be surrounded in angle braces. If you omit them, sendmail will add them for you:

<user@example.com>

The args is optional. ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.