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 email@example.com REJECT
When I do a mail to that email address, it still gets forwarded.
alexis $ mail -s "Verify block" firstname.lastname@example.org 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 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?