We had an interesting one with Postfix, we were recieving mail fine from all other domains. Then one domain (in this case domain.co.uk) started not to get through, no changes had been made at our end.
What was happening was that their domain.co.uk nameservers were not reporting TXT records properly, rather than reporting nothing or an SPF record we were getting a “SERVFAIL”, the postfix spf script we used then started to block all mail with a temporary error 450.
Obviously they needed to fix their domain, but to workaround I did the below:
Sep 27 09:02:20 oakmail postfix/policy-spf: : Policy action=DEFER_IF_PERMIT SPF-Result=domain.co.uk: ‘SERVFAIL’ error on DNS ‘SPF’ lookup of ‘domain.co.uk’
Sep 27 09:02:20 oakmail postfix/smtpd: NOQUEUE: reject: RCPT from mail.domain.co.uk[126.96.36.199]: 450 4.7.1 firstname.lastname@example.org: Recipient address rejected: SPF-Result=domain.co.uk: ‘SERVFAIL’ error on DNS ‘SPF’ lookup of ‘domain.co.uk’; email@example.com firstname.lastname@example.org proto=ESMTP helo=<mail.domain.co.uk>
Edited the /usr/share/perl5/Mail/SPF/Server.pm file on the server, and then found this line:
$packet->header->rcode =~ /^(NOERROR|NXDOMAIN)$/
And changed it to:
$packet->header->rcode =~ /^(NOERROR|NXDOMAIN|SERVFAIL)$/
Once done restart the postfix service, then when the sender tried again the messages came through fine. Basically it changed the SERVFAIL from a temporary error to a just ignore and pass the mail anyway type issue.