Overall goal:
Block specific emails with have "a name" included in their FROM envelope. Example: John <john@example.com>
Current situation:
I have successfully configured the main.cf
of Postfix to utilize check_sender_access
in smtpd_recipient_restrictions
.
I have created my own sender_access
file, used postmap on it, so it generates sender_access.db, which is used then by main.cf
.
My sender_access file looks like this:
john@example.com REJECT
support@example.com REJECT
This configuration does works as intended and rejects the email when somebody sends an inbound email with "clear" FROM envelope (Example: FROM: support@example.com
):

This configuration does not work and reject the email when the sender has set a "name" which appears in the FROM envelope (Example: FROM: John <john@example.com>
or FROM: Support <support@example.com>
):

The configuration "does not catch" the email address either when the "name" is the same as the email address (some default behavior in some MTA /mail transfer agents/):

What I have tried:
I have tried a sender_access file with the following formatting:
john@example.com REJECT
John <john@example.com> REJECT
"John <john@example.com>" REJECT
John REJECT
<john@example.com> REJECT
"john@example.com" REJECT
john@ REJECT
None of these have practically worked. The only thing which works is if I reject the entire domain:
example.com REJECT
My question:
I have been searching for two days now, tried many articles and finally decided to ask here. Does Postfix support blocking of senders with FROM in the format John <john@example.com>
?
Do I need to try some regex (interestingly, I didn't found any - one would think this is something commonsense?).
P.S: Perhaps something which always "catches" the email address inside the brackets in bold:
John <john@example.com>
Thank you!