Please read the below article carefully. It will save you a lot of trouble.

http://www.postfix.org/SMTPD_ACCESS_README.html
On Nov 23, 2013 3:39 PM, "Alexander Farber" <alexander.far...@gmail.com>
wrote:

> Hello Peter and others,
>
> On Sat, Nov 23, 2013 at 1:38 AM, Peter <pe...@pajamian.dhs.org> wrote:
>
>> On 11/23/2013 12:38 AM, Alexander Farber wrote:
>> > /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.
>>
>
> thank you! So I have moved the line
>
>     /^To: \S+\.\S+\.\S+\.\s...@gmail.com$/i DISCARD
>
> to the file /etc/postfix/access, but when I run
>
>     # postmap /etc/postfix/access
>
> I get the warning:
>
>     postmap: warning: /etc/postfix/access, line 452: record is in "key:
> value" format; is this an alias file?
>
> postmap seems not to like the whitespace after "To:",
> should I replace that space by \s+ as workaround?
> Or can I somehow tell postmap (I've read its manpage,
> but haven't find the answer), that it is a pcre database?
>
> And another question is what directive to put into
> main.cf to enable the check_recipient_access
> for OUTGOING mails?
>
> Regards
> Alex
>
>
>
>
>

Reply via email to