Can I prevent postfix from sending to specific email addresses using the check_recipient_access postfix option?
0
votes
1
answer
2361
views
I tried to block some email addresses from spammers, but this setup doesn't seem to have any effect:
smtpd_recipient_restrictions =
check_recipient_access hash:/etc/postfix/bad_recipients,
permit_sasl_authenticated,
permit_mynetworks,
...
The emails are still forwarded. Here is an example of the bad_recipients file I have:
# When updating, make sure to run this command once:
# postmap hash:/etc/postfix/bad_recipients
spammer@example.com REJECT
When I do a mail to that email address, it still gets forwarded.
alexis $ mail -s "Verify block" spammer@example.com
Cc:
Not much of interest here.
^D
When I look at the logs I see something like this:
> Mar 5 20:02:37 do postfix/smtp: E827740ADA: to=,
> relay=mail.example.com[10.0.0.13]:25, delay=2.3, delays=0.03/0.01/1.8/0.41,
> dsn=5.7.1, status=bounced (host mail.example.com[10.0.0.13] said: 550 5.7.1
> No such user! (in reply to RCPT TO command))
_Note: I edited the domain name and IP address._
The relaying to the external source clearly shows that my
smtpd_recipient_restrictions
settings did not block anything. I'm thinking that either it only accepts domains (although I think [the doc examples here](http://www.postfix.org/RESTRICTION_CLASS_README.html) say otherwise) or I have something else that tells postfix to ignore my list of recipient restrictions. Do you know how to make this feature work?
Asked by Alexis Wilke
(3095 rep)
Mar 5, 2020, 08:17 PM
Last activity: May 9, 2025, 07:04 PM
Last activity: May 9, 2025, 07:04 PM