On 6/27/2016 3:39 AM, Zalezny Niezalezny wrote:
> Hi, 
> 
> using header_checks configuration we are dropping all outgoing
> E-mails except some of them. 
> 
> 
> # discard all mails not going to cortalconsors.(de|fr)
> if /^to:/
> !/^to:<?.*@(extern\.)?(domain)\.(com)>?$/ DISCARD discarded 
> endif
> 
> Following rules dropping all outgoing e-mails with recipeint domains
> different than
> 
> extern.domain.com <http://extern.domain.com>
> domain.com <http://domain.com>
> 
> When You sending an E-mail to:
> 
> To:<zalezny.niezale...@gmail.com <mailto:zalezny.niezale...@gmail.com>>
> 
> Postfix dropping that E-mail.
> 
> 
> 
> But when You will send an e-mail to two recipients
> 
> To:<u...@extern.domain.com
> <mailto:u...@extern.domain.com>>,<zalezny.niezale...@gmail.com
> <mailto:zalezny.niezale...@gmail.com>>
> 
> system will deliver both. 
> 
> 
> 
> 
> Why system not dropping E-mail addressed to
> <zalezny.niezale...@gmail.com <mailto:zalezny.niezale...@gmail.com>>
> ? Its clear described in the rule, drop all except... 
> 
> 
> I will appreciate for any help.
> 
> 
> 
> 
> With kind regards
> 
> zalezny
> 
> 


The failure you're seeing when there are two addresses in the header
is because your expression only matches when there is a single
address.  But header_checks is the wrong tool for this job; the To:
header does not control where mail is delivered.

A more robust solution is to limit where postfix can deliver mail.

# main.cf
default_transport = error:remote delivery disabled
transport_maps = hash:/etc/postfix/transport

# /etc/postfix/transport
domain.com  smtp:
extern.domain.com  smtp:



http://www.postfix.org/transport.5.html



  -- Noel Jones

Reply via email to