Miguel Da Silva - Centro de Matemática wrote:
I wrote down the following regular expression, would it work properly?!

if /^[> ]*From:(.*)(cmat\.edu\.uy)/
if /^[> ]*Message-ID/
!/^[> ]*Message-ID:(.*)(cmat\.edu\.uy)/
    REJECT Message-ID and From incorrect
endif
endif

My idea is reject mail whose From header seems to have an e-mail from my domain, but according to the Message-ID header this message could not be sent from my server.

No. If you need to take decisions based on the contents of multiple lines, use a content filter.

This is explained in body_checks(5), which you can read on your system (man body_checks) or on the web:
        http://www.postfix.org/header_checks.5.html

In particular, read the part that says:
<cite>
...
       Many people overlook the main limitations  of  header  and
       body_checks rules.

       o      These  rules  operate on one logical message header
              or one body line at a time. A decision made for one
              line is not carried over to the next line.

       o      If  text  in the message body is encoded (RFC 2045)
              then the rules need to be specified for the encoded
              form.

       o      Likewise,  when  message  headers  are encoded (RFC
              2047) then the rules need to be specified  for  the
              encoded form.
...
</cite>




I'm using body_checks because these "headers" come as part of bounce messages we're receiving (backscatter).

Thank you.

Reply via email to