Yahoo are still sending me spam, so I’ve decided to block all emails from, this is the method I’ve used:

1) Create a file using with your blacklisted addresses/domains with customised responses as follows:

# Specific users 550 Sorry user, I've had enough of your spam
# Whole domains 550 Messages not accepted from the domain
# Whole domains with a non-customised response REJECT

2) Convert this text file into a Postfix-compatible database with postmap file (output will be file.db) (Note: on Debian systems will need to be root to run postmap)

2a) Put the file into the /etc/postfix folder

3) Open /etc/postfix/

4) Reference file.db with

check_sender_access hash: /path/to/file (leave off the .db extension)

option in your smtpd_recipient_restrictions directive.

My looks like this:

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/, reject_unauth_destination, check_sender_access hash:/etc/postfix/yahoo

The above is all one line.

And my test email was rejected:

Mar 7 18:44:09 mail postfix/smtpd[25917]: NOQUEUE: reject: RCPT from[]: 550 5.7.1 Sender address rejected: Sorry Yahoo! email user, too much spam from your domain, try using gmail.; proto=SMTP helo=

And will look something like this to the person sending the email:

yahoo spam

Credit to MJN.

Source: here