Blacklist single recipient

Questions and answers about how to do stuff
Post Reply
jonassimpson
Posts: 2
Joined: 09 Jan 2022 22:21

Blacklist single recipient

Post by jonassimpson »

Hi,

I have a single recipient address "user-alias@mydomain.com" that I want EFA to reject prior to delivery, ideally during the SMTP transaction. It's an internal email address that is used for reporting and for sending but I do not want any inbound mail to pass EFA or reach the mail systems behind it. I've read a few things and attempted several ways to achieve this but none seem to work.

I know that Mailscanner wildcards aren't an option, so I also looked at the spamassassin blacklist_to approach. Adding the recipient in local.cf seemed to have no effect.

Can anyone offer advice or a definitive solution to this specific problem?

Thanks,

JS
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Blacklist single recipient

Post by shawniverson »

Best place to do this is in postfix.

You can do this with a recipient restriction. You probably will need to send up an access list and add it to the smtpd_recipient_restrictions in /etc/postfix/main.cf

/etc/postfix/main.cf

Code: Select all

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_non_fqdn_recipient, reject_unknown_recipient_domain, check_recipient_access hash:/etc/postfix/recipient_access, reject_unverified_recipient
/etc/postfix/recipient_access

Code: Select all

user@example.com	REJECT
Or if you want to just silently drop it...

/etc/postfix/recipient_access

Code: Select all

user@example.com	DISCARD
Run postmap to create the compiled table...

Code: Select all

sudo postmap /etc/postfix/recipient_access
http://www.postfix.org/SMTPD_ACCESS_README.html
jonassimpson
Posts: 2
Joined: 09 Jan 2022 22:21

Re: Blacklist single recipient

Post by jonassimpson »

Works perfectly!

Thanks for the concise yet thorough instructions, I'm very grateful. :D
Post Reply