Sendmail filtering for spams with access file

Solution Unverified - Updated -


  • It is possible to reject accessing from particuler hosts/IP(s)  to a sendmail server by those ways?

1.Adding lines into /etc/mail/access file as follows.

# vi /etc/mail/access RELAY RELAY

The above setting expects that only '' and '' are allowed to access the sendmail server, and any other host is rejected.

2.Setting iptables' rules as follows.

# iptables -I INPUT -p tcp --dport 25 -j REJECT
# iptables -I INPUT -p -s 'IP ADDRESS1' --dport 25 -j ACCEPT
# iptables -I INPUT -p -s 'IP ADDRESS2' --dport 25 -j ACCEPT

This iptables setting is also similar meaming of the first one, which means that only the 'IP ADDRESS1' and 'IP ADDRESS2' can be accessed to the sendmail server, and any other host(IP ADDRESS) is rejected.


  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • sendmail

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content