On Tue, Sep 03, 2019 at 08:50:51AM +0200, Benoit Panizzon wrote:
> I see that the envelope sender contains 8 bit
> characters, AFAIK against valid RFC. Example:
>
> <Aloï[email protected]>
>
> We use MIMEDefang as a milter, so I could basically try filter 8bit
> sender there, but I would rather use the built in mechanisms of
> postfix, if such one exists.
You can use "check_sender_access" in combination with a PCRE table:
/[^[:ascii:]]/ REJECT 5.1.7 Malformed sender address
BUT, you MUST be sure to remove that rule if/when you enable SMTPUTF8.
Demo (uses "bash" inline file syntax):
$ postmap -q - pcre:<(
printf '%s\n%s\n%s\n%s\n' \
'if /[^[:ascii:]]/' \
'/(.*)/ Non-ascii ${1}' \
'endif' \
'/(.*)/ ASCII ${1}'
) << 'EOF'
> виктор@example.org
> [email protected]
EOF
виктор@example.org Non-ascii виктор@example.org
[email protected] ASCII [email protected]
--
Viktor.