Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have an inbound email service that is very restrictive on who is allowed to send through our Sendmail gateways. The restrictions are generally controlled through the access file by marking certain servers, IPs or networks as OK -- everything else is rejected.

This method becomes difficult to control when customers are using hosted solutions like Google Apps or Office 365, where mail could come from any number of servers or networks.

In order to get around that, what I would like to add as a feature are SPF checks on certain sender domains. If their domain passes SPF, then they are allowed to send to us; otherwise the message will be rejected.

It seems there are a few milters out there to handle SPF, but documentation is sparse.

So the question...

What options do I have for SPF filtering in Sendmail which can be limited to certain sender domains?

share|improve this question
What's the question? – symcbean Jan 23 '12 at 17:02
Why are they sending THROUGH your servers? – joeqwerty Jan 23 '12 at 17:12
@symcbean: I think he's asking what SPF milter should he go and try. – adamo Jan 23 '12 at 18:17
@joeqwerty: I think he refers to the ability provided from certain mail providers to send mail as a user from another domain. If his domain is, then their servers will see incoming mail say from Gmail that claims to be from a They do not seem to allow that. – adamo Jan 23 '12 at 18:20
@joeqwerty I'm pretty sure he's receiving e-mail and just want to eliminate almost all SPAM by only allowing e-mail that Passes SPF. I've considered this myself as most reputable domains publish SPF these days. – Chris S Jan 23 '12 at 18:20

Well there is spfmilter and milter-spiff just to name two. And milter-spiff's documentation is far from sparse. We're using for many years now without any problems.

share|improve this answer
So some of the relevant configuration files/example/documentation would be??? – Chris S Jan 23 '12 at 18:18
The documentation page for milter-spiff is here. You can run "milter-spiff -help" and it will output a very well commented configuration file which you can save, edit and use afterwards. – adamo Jan 23 '12 at 18:29
milter-spiff seems to be what I need. I will need to spend some time testing. – Doug Luxem Jan 23 '12 at 20:10
It appears that both of these only do blanket SPF filtering, and I cannot limit the checks to certain sender domains. – Doug Luxem Jan 24 '12 at 14:58
The you can install MIMEDefang along with Mail::SPF::Query and write your own custom sets within the filter_recipient routine. – adamo Jan 24 '12 at 15:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.