Local_check_rcpt and check_rcpt

The Local_check_rcpt rule set provides a hook into the check_rcpt rule set, which is used to validate the recipient-sender address given in the RCPT To: command in the SMTP dialog:

RCPT To:<recipient@host.domain>

The check_rcpt rule set is called immediately after the RCPT To: command is read. The workspace that is passed to check_rcpt is the address following the colon. The envelope-recipient address might or might not be surrounded by angle brackets and might or might not have other RFC2822 comments associated with it.

The check_rcpt rule set has default rules that do the following:

  • Reject empty envelope-recipient addresses, such as < >, and those which have nothing following the RCPT To:.

  • Ensure that the envelope-recipient address is either local, or one that is allowed to be relayed.

  • If the access database (The access Database on page 277) is used, look up the envelope-recipient’s host in that database and reject, accept, or defer the message based on the returned lookup value. If the FEATURE(blacklist_recipients) (Reject per Recipient on page 284) is declared, they also look up the envelope recipient in that database.

The Local_check_rcpt gives you a hook into the check_rcpt rule set before any of the default rules are called. To illustrate one use for the Local_check_rcpt rule set, consider the need to reject all incoming mail destined for the recipient named fax. One method might look like this:

LOCAL_RULESETS SLocal_check_rcpt R $* $: $>canonify $1 ...

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.