Page 1 of 1

Blacklist single recipient

Posted: 09 Jan 2022 22:46
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

Re: Blacklist single recipient

Posted: 12 Jan 2022 14:57
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

Re: Blacklist single recipient

Posted: 12 Jan 2022 21:21
by jonassimpson
Works perfectly!

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