Accept and Reject per Recipient

When a connection is made to your site by another, the access database is checked to reject unwanted connections.[133] It is checked again when the SMTP MAIL From: command is given to accept or reject the envelope sender. It is checked a third time when the SMTP RCPT To: command is given to accept or reject the envelope recipient, and prevent unwanted relaying.

This order is good for most sites, but might not be the best for your particular needs. In case it isn’t, the FEATURE(delay_checks) offers a way to check the SMTP RCPT To: address first, before the other two checks, and then proceed with those other two checks, if appropriate. Delayed checks are enabled with the FEATURE(delay_checks) which you declare in your mc file like this:

FEATURE(access_db)
FEATURE(delay_checks)

Note that the FEATURE(access_db) needs to be enabled before you enable the FEATURE(delay_checks).

Once enabled, the order of checks is changed. If the righthand side in the access database is either REJECT or an SMTP error for the envelope recipient, the envelope recipient is rejected as usual. But if the envelope recipient is allowed, the envelope sender is then checked, and if it is rejected, the envelope recipient is rejected with the envelope sender’s error message. If the envelope sender is allowed, the connecting host is checked, and if it is rejected, the envelope recipient is rejected with the connecting host’s error message.

For example, consider the following abstract from ...

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.