Milter xxfi_envrcpt()

Process an envelope recipient All Milter versions

After the connecting client has issued the SMTP MAIL From: command to specify the envelope sender, the connecting client then (normally) sends one or more envelope recipients using an RCPT To: SMTP command to send each. After the RCPT To: has been received, but before sendmail responds to that command, the xxfi_envrcpt() function, if used, is called.

The xxfi_envrcpt() function is called like this:

sfsistat
xxfi_envrcpt(SMFICTX *ctx, char **argv)

Here, ctx is the context pointer passed to all xxfi_ functions to maintain state in a multi-threaded environment. The argv is an array of pointers to strings. The zeroth string is always the envelope-recipient address. This is the address as it was received by sendmail and could easily be in an unexpected format:

argv[0] →  "you"
argv[0] →  "<you>"
argv[0] →  "<you <you@your.domain>>"

Your Milter should be prepared to handle oddly formed addresses.

If the envelope recipient is followed by one or more ESMTP extensions, each extension will be copied to a subsequent string in the order they appeared in the RCPT To: command. For example, the following RCPT To: command:

RCPT To: <you@your.domain> ORCPT=rfc822;you@your.sub.domain

will yield the following values in argv:

argv[0] →  "<you@your.domain>"
argv[1] →  "ORCPT=rfc822;you@your.sub.domain"
argv[2] →  NULL

The xxfi_envrcpt() function can return any of several values that determine the further handling of the envelope recipient:

SMFIS_CONTINUE ...

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.