On 2/13/2011 6:37 PM, Franck MAHE wrote:
OK, so this configuration seems to work fine.
/^From:.*<.*(\[|\]|\(|\)|\`|\;|\,|\^|\#|\:|\||\\|\@|<|>|\/|\!|\
|\$|"|"|\%|\&|').*@.*>/
REJECT "3 - Your Email address is not compliant with RFC, Go Away"
if !/^From:.*<.*@.*>/
/^From:.*([|]|\(|\)|`|;|,|^|#|:|\||\\|@|<|>|\/|!|$|"|%|&|').*@/ REJECT
"4 - Your Email address is not compliant with RFC, Go Away"
Endif
In fact, for the regexp REJECT 4, if I leave \s, then all
header From: u...@domain.tld <mailto:u...@domain.tld> are
rejected, but with this one
postmap -q "From: u&s...@domain.tld"
regexp:/etc/postfix/regexp_table returns REJECT "4 - Your
Email address is not compliant with RFC, Go Away"
postmap -q "From: u...@domain.tld"
regexp:/etc/postfix/regexp_table returns ACCEPT
I don’t really need the same thing for the domain part as I
reject all the mail with an invalid domain name.
Any idea for the REJECT 4 to reject the header “From: us
e...@domain.tld <mailto:e...@domain.tld>", ie with a space in the
first part.
Thanks for your help
Some thoughts...
Parsing the From: header for RFC822 compliance with a regular
expression is pretty much impossible. If you search the
archives carefully, you'll find numerous examples of what
doesn't work due to false positives, and no complete examples
of what does.
Discussing fine points of regular expression matching is
nearly impossible with your HTML mangled mail. What you typed
is often not what the recipient sees. That's one reason this
list strongly encourages plain-text only.
The header_checks if..endif construct works exactly as documented.
-- Noel Jones