Milter smfi_addrcpt()

Add an envelope recipient All sendmail versions

The smfi_addrcpt() Milter library routine is used to add an envelope recipient to the envelope. To remove an envelope recipient use smfi_delrcpt() (Milter smfi_delrcpt() on page 1189). To include ESMTP arguments along with the new recipient use smfi_addrcpt_par() (Milter smfi_addrcpt_par() on page 1186).

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

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

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

The smfi_addrcpt() 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_addrcpt(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 add. On success, MI_SUCCESS will be returned (to ret). MI_FAILURE will be returned if anything went wrong.

The addr must be in the form of a string composed of a user part and a host part separated by an @ character:

"user@example.com"

Local addresses may omit the @ and the domain part:

"user"

The new address is added by sendmail. If there is a problem with the address, the problem will be completely handled by sendmail and your Milter will not be notified. You may enclose the address ...

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.