On 02/13/2011 10:33 PM, Franck MAHE wrote:
Hello,
I've the following in main.cf
header_checks = regexp:/etc/postfix/regexp_table
My postfix release is 2.3.8
I've the following in my header_checks regex table:
# MAL FORMATED EMAIL ADDRESS
/^From:.*\.@.*/ REJECT "1 - Your Email address is not
compliant with RFC, Go Away"
/^From:.*<.*\.\..*@.*>/ REJECT "2 - Your Email address is not
compliant with RFC, Go Away"
/^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
All is fine for REJECT 1, 2 & 3, however when the From field is only
"From: u...@domain.tld <mailto:u...@domain.tld>", the REJECT 4 is not
taken into account, ie the REJECT 4 seems not to be tested. So, it
seems that the if...endif block is not working.
Do you have any idea to solve that?
Franck
-------------------------------------------
E: m...@civis.net <mailto:m...@civis.net>
"From: u...@domain.tld <mailto:u...@domain.tld>" does not match
/^From:.*(\[|\]|\(|\)|\`|\;|\,|\^|\#|\:|\||\\|\@|<|>|\/|\!|\
|\$|"|"|\%|\&|')@.*/
The regex requires the locapart to end with one of the listed
characters; your example does not, it is perfectly valid.
I would also implore you to use character classes to make this less
unreadable:
/^From:.*[[\]()`;,\^#:|\\@<>/! $"%&']@.*/
In a regex character class, almost all characters lose their special
meaning, so they don't have to be escaped.
But as stated above, requiring one of these characters between the
localpart and the @ sign will not match the valid address you gave as an
example.
--
J.