Basically you don't want mail to be bounced here, but for some senders your server should still generate additional message.
You can write a script that can build a message that looks like a bounce (e.g. creating a "fake bounce"), and arrange things so that messages from this sender trigger this script, in addition to normal delivery.
One way to do that is to set always_bcc
to some alias, and the target of that alias should be the script path prefixed with the pipe, so the script will be run and fed with the message to parse. The message will appear at stdin. The script could then parse the message, check the sender address and either exit succesfully doing nothing or create a fake bounce. Since this is just an additional receiver of the message, it won't change the standard mail reception path; the mail still be delivered to whoever it was originally destined too. But make sure the script always exists successfully (e.g. never fails with any non-zero error code), else the sender will have real bounce, quite cryptic one.
In /etc/aliases
add:
bcc_script: |/usr/local/bin/bcc_script.py
(don't forget to run newaliases
after editing this file).
In /etc/postfix/main.cf
add:
always_bcc = bcc_script
The /usr/local/bin/bcc_script.py
will begin similar to this:
#!/bin/env python3
import sys, email
try:
msg = email.message_from_bytes(sys.stdin.read())
if msg['From'] != '[email protected]':
sys.exit(0)
# creating of the fake bounce here
...
except Exception:
pass
# do nothing, fail silently to avoid bounces if the code above throws runtime error
Note that I didn't tested this code and it might not work right away. You can find other examples on the Internet.