Milter smfi_delrcpt()

Remove an envelope recipient All sendmail versions

The smfi_delrcpt() Milter library routine is used to remove an envelope recipient from the envelope. To add an envelope recipient use smfi_addrcpt() (Milter smfi_addrcpt() on page 1185).

Before you can remove any recipients, you first need to declare your intention to do so by including the SMFIF_DELRCPT flag in the flags portion of the smfiDesc structure:

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

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

The smfi_delrcpt() routine may be called only from within an xxfi_eom() function you write (Milter xxfi_eom() on page 1215). It is called like this:

ret = smfi_delrcpt(ctx, addr);

Here, ctx is the common context pointer that was passed to your xxfi_eom() function. The addr is the email address of the recipient you wish to delete. On success, MI_SUCCESS will be returned (to ret). MI_FAILURE will be returned if anything went wrong. But note that you are only suggesting to sendmail that it should remove the recipient. Note too that even if the recipient doesn’t exist in sendmail’s list of addresses, the call to smfi_delrcpt() will still succeed.

The addr must be in the form of a string composed of a user part and a host part separated by an @ character. The entire address must be surrounded in angle braces:

<user@example.com>

For an address to be removed, it must exactly match an address in sendmail’s recipient ...

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.