Refuse to send email to specific recipients with Postfix
The problem is that the mail is sent via the pickup
service (via sendmail inteface) and so it is an "outgoing" mail. For outgoing mail the smtpd_*_restrictions
don't apply. These restrictions only apply for "incoming" mails that have been sent via SMTP.
Edit There is even a solution provided by Victor Duchovni (Postfix maintainer): http://marc.info/?l=postfix-users&m=120155612332393&w=1
As @mailq says, the "mail" program does not inject messages via SMTP, the "smtpd_recipient_restrictions" only applies to messages received via SMTP. So, for example, if you run this you should see it showing the reject:
printf 'ehlo hostname.domain.com\nmail from: <[email protected]>\nrcpt to:' \
'<[email protected]>\nquit\n' | nc localhost 25
This does an SMTP connection via "netcat" (usually called "nc"), and should demonstrate that the block is indeed in place.
Perhaps this is enough? If not, the only way I can come up with to do a rejection for this remote address is to set up a transport that rejects messages sent to it, and then list that address in the transport table to be associated with the rejecting transport.