Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postfix: how to block incoming emails to a specific recipient?

Tags:

postfix-mta

I have Postfix set up to deliver all incoming email to ⟨any_random_address⟩@mydomain.com to [email protected]. I've recently noticed that a large percentage of spam is going to the same non-existent username, and I'd like to block incoming email to that username, while still sending all other emails to my inbox. What is the best way to accomplish that?

like image 856
Saul Tobin Avatar asked Nov 29 '25 18:11

Saul Tobin


1 Answers

Aside from the fact that catch-all doesn't really make sense:

In your virtual aliases map (e.g. /etc/postfix/virtual_alias_maps), add the following line:

[email protected] devnull

In /etc/aliases, add the following line:

devnull:  /dev/null

This defines a mailbox named devnull and stores its contents in /dev/null.

Don't forget to update the alias caches and restart Postfix, for example like

sudo postmap /etc/postfix/virtual_alias_maps
sudo newaliases
sudo service postfix restart

Now you should be fine.

like image 164
lxg Avatar answered Dec 02 '25 03:12

lxg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!