On 11/23/2013 12:38 AM, Alexander Farber wrote: > So the following seems to work for me for now - > > /etc/postfix/header_checks: > > /^To: \S+\.\S+\.\S+\.\s...@gmail.com <mailto:s...@gmail.com>$/i DISCARD > > /etc/postfix/main.cf <http://main.cf>: > > header_checks = pcre:/etc/postfix/header_checks
Header checks will certainly work, but it requires that postfix does deep inspection of the message DATA in order to and before it can reject the message. You're much better off checking the envelope recipient with a check_recipient_access restriction. This too can use a pcre table so you can match the recipient address against a regular expression with three dots, then postfix won't have to do deep inspection of the DATA packet, and can reject the mail at the RCPT TO stage before the DATA is even transmitted to postfix, much more efficient. Note: Others have stated that this should really be done in your web app, and I agree with that, but I won't go into that as you seem to clearly indicate that you just want postfix advice here, so my advice is that if you *must* do it in postfix, then you should use check_recipient_access instead of header_checks. Peter