The access file offers you the ability to block incoming Email messages based on the Email address or sending domain of the incoming message. Some specific options you can chose include the following.

  • Reject e-mail from specific users, domains, IP addresses, and networks.
  • Specify the text (or use sendmail's default) of messages to return to senders of rejected e-mail.
  • Accept e-mail from specific users within a domain, while rejecting e-mail from all other senders in the domain.
  • Reject e-mail sent to specific local users.

There are also a number of other features of the access file, which are documented in the /etc/mail/README file.

The access file settings are already built in to your VPS sendmail configuration. In order to use them, however, you must first create an access.db file in your /etc/mail directory.

The first step in creating your access.db file is to create a plain-text file in your /etc/mail directory named access. This should contain the domain or email account you want to base the filtering on, with a rule. Detailed instructions for using the access file are included in the /etc/mail/README file, but a few of the more common rules are listed here.


Accept mail even if other rules in the running rule set would reject it, for example, if the domain name is un-resolvable. "Accept" does not mean "relay", but at most acceptance for local recipients. That is, OK allows less than RELAY.


Accept mail addressed to the indicated domain or received from the indicated domain for relaying through your SMTP server. RELAY also serves as an implicit OK for the other checks.


Reject the sender or recipient with a general purpose message.

ERROR:### "any text"

the Error number should be an RFC 821 compliant error code, and "any text" is a message to return for the command. The string should be quoted to avoid surprises, e.g., sendmail may remove spaces otherwise.

The following is an example of a few different possible entries you could have in your access file.        ERROR:550 "We don't accept mail from spammers"   OK            RELAY
128.32                  RELAY
IPv6:1:2:3:4:5:6:7      RELAY
[]             OK
[IPv6:1:2:3:4:5:6:7:8]  OK

After you have created your /etc/mail/access file, you must convert it into a .db file which sendmail can read. To do this, run the following command (as root) on your VPS.

# makemap hash /etc/mail/access < /etc/mail/access

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771