Joseph Tam writes:
However, my header_checks file has just 5 lines of regexp as follows: ... /^From:.*\@.*\.tw/ REJECT Sorry, Taiwanese mail is not allowed.
Can't speak about the other issues you are having, but is this regexp pattern what you want? Unless Postfix PCRE automatically right-anchors these regexps, aren't you rejecting mail from someone@mail.twinpeaks.org, or even twitter notifications (from *@bounce.twitter.com). I am not sure I even understand what you were trying to say. It's either because you have no idea how to write any regexp / pcre rules or I did not understand your wording. The rule means: / means a regular expression. Any regular expression is enclosed in forward slashes. For example /Josepsh/ is already the simplest rule in regexp and pcre. ^ it is called caret and indicates the beginning of a line / expression From: is the field I refer to . means any character
- matches zero or any number of occurrences of the previous character \ it's called escape that treats any character after it as a regular character (item), not regexp tw means two letters at the end of an email address for example mail@example.tw What it basically does it blocks any email address that ends on .tw Plus, if you refer to the post I wrote it clearly says that running the following on your command line postmap –q "From: mail@example.tw” regexp:/etc/postfix/header_checks will tell you if the rule is correct or not. This is a bullet / fool proof method. The file called header_checks has to exist of course and it has to contain the rule mentioned above. Plus, I also said in my post that regexp were not the problem in my case at all as it literally takes only 5 seconds and has a couple of dozen various methods to check if the rules are correct or not despite the fact that they come from "stone age" computing like I do myself as well. Honestly speaking it was funny to see how so many people started picking on regexpes in the first place without actually having any clear understanding about how they work.