Local_check_mail and check_mail

The Local_check_mail rule set provides a hook into the check_mail rule set, which is used to validate the envelope-sender address given in the MAIL From: command of the SMTP dialog:

MAIL From:<sender@host.domain>

The check_mail rule set is called immediately after the MAIL From: command is read. The workspace passed to check_mail is the address following the colon in the MAIL From: command. That envelope-sender address might or might not be surrounded by angle braces.

If sendmail’s delivery mode is anything other than deferred (-bd on page 234), the check_mail rule set performs the following default actions:

  • Calls the tls_client rule set (The access database with tls_server and tls_client on page 214) to perform TLS verification, if needed

  • Accepts all envelope-sender addresses of the form < >

  • Makes certain that the host and domain part of the envelope-sender address exists

  • If the access database (The access Database on page 277) is used, looks up the envelope-sender in that database and rejects, accepts, or defers the message based on the returned lookup value

The Local_check_mail rule set provides a hook into check_mail before the preceding checks are made, and provides a place for you to insert your own rules.

To illustrate one use for the Local_check_mail rule set, consider the need to accept all mail from an internal domain, even when many of the hosts in that domain cannot be looked up with DNS.[120] One method might look like this:

LOCAL_RULESETS SLocal_check_mail ...

Get sendmail, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.