- Accept or Reject mail from selected Domains / Users using Sendmail

The access database file can be created to accept or reject mail from selected domains. For example, you may choose to reject all mail originating from known spammers, or to accept to relay all mail from your local network.

The /etc/mail/access file has two columns. The first lists IP addresses and domains from which the mail is coming or going. The second lists the type of action to be taken when mail from these sources or destinations is received. Keywords include RELAY, REJECT, OK (not ACCEPT), and DISCARD
spammer@aol.com         REJECT
cyberspammer.com         REJECT
192.168.212                     REJECT
spammer@aol.com         REJECT

cyberspammer2.com           550 We don't accept mail from spammers
okay.cyberspammer.com    OK
sendmail.org                         OK
128.32                                   RELAY
# You can also use the access database to block sender addresses based on
# the user name portion of the address. For example:
FREE.STEALTH.MAILER@    550 Spam not accepted
# by default we allow relaying from localhost
localhost.localdomain      RELAY
localhost                            RELAY
127.0.0.1                           RELAY
192.168.1                          RELAY
You'll then have to convert this text file into a sendmail readable database file named /etc/mail/access.db. Here are the commands you need:
makemap hash /etc/mail/access.db < /etc/mail/access


source:http://linuxpoison.blogspot.com/2010/04/135781677510056.html