postfix: Reject some recipient adresses while using catchall on a domain

If you have a catchall on a domain – like anginf.de – you will probably get spam on some adresses which you would like to exclude from the general catchall. This can be achieved by doing some simple steps.

First you have to create a file /etc/postfix/recipient_block with all those email adresses you want rejected:

spam@anginf.de REJECT
morespam@anginf.de REJECT

To be useable for postfix, you have to postmap this file.

root@host:~# postmap /etc/postfix/recipient_block

In your /etc/postfx/main.cf, add a new line to your smtpd_recipient_restrictions:

hash:/etc/postfix/recipient_block

Now you only have to reload postfix and all mails to those mentioned in /etc/postfix/recipient_block will be rejected:

root@host:~# service postfix reload

Schreibe einen Kommentar