Eduardo Maia:
> Hi,
> 
> I need to block emails with fake FROM like :
> 
> From: "Nick Blue <n...@domain.pt>" <yk...@omega-eng.co.jp>
> 
> 
> The postfix has the feature header_checks and mime_header_checks. When 
> the FROM is with plain text, it works fine, but when the FROM is mime 
> encoded like this:
> 
> From: =?UTF-8?B?PElQQlJJQ0sgbsK6IDMyNTc0PiBhc2FudG9zQGlwYnJpY2suY29t?=
> <alcal...@ayuntamientocamaleno.com>
> 
> the email is not blocked, even with mime_header_checks.

You are going to need a Milter or other kind of content filter to
do this. Postfix has no built-in content manipulation language.

https://github.com/mikenye/milter-decode-headers

This actually inserts decoded headers 

    X-Decoded-From:
    X-Decoded-From-Encoding: 

And similar for Subject: headers if you want to decode those, too

You should IGNORE those inserted headers for mail that is not
rejected:

milter_header_checkds configuration:

    IF /^X-Decoded-From/
    /^X-Decoded-From: some evil pattern/        REJECT
    # Ignore X-Decoded-From: and X-Decoded-From-Encoding:
    .   IGNORE
    ENDIF

And similar for Subject: headers if you want to decode those, too

DO NOT put whitespace before text inside IF and ENDIF.

        Wietse

Reply via email to