On 9/23/2014 2:31 PM, Michael Fox wrote:
> Sanity check please:
> 
>  
> 
> I have a relay machine:  relay.domain1.com
> 
> And a client:  client.domain2.com
> 
>  
> 
> I’d like to filter (silently discard) messages at the relay machine
> from going to any account on the client machine if the From: address
> is: groupsupda...@yahoogroups.com
> <mailto:groupsupda...@yahoogroups.com>.  But such messages going to
> accounts on the relay machine are o.k.
> 
>  
> 
> So, is it correct that I could use something like this:
> 
>  
> 
> main.cf:
> 
>     smtp_header_checks = pcre:/etc/postfix/smtp_header_checks.pcre
> 
>  
> 
> smtp_header_checks.pcre:
> 
>     /^From: .*groupsupda...@yahoogroups.com.*/
> <mailto:.*groupsupda...@yahoogroups.com.*/>  DISCARD optional-log-text
> 
>  
> 

No, smtp_header_checks cannot change a message destination (ie.
discard instead of deliver).

Note filtering on the From: header is generally wrong, use the
envelope sender instead.  And it's generally considered bad to
DISCARD messages; mail shouldn't disappear except under
extraordinary circumstances.

What you can do is create a restriction class to check the sender
and the recipient, and reject the message if both match.  The
general procedure is outlined here, with some examples similar to
what you're asking:
http://www.postfix.org/RESTRICTION_CLASS_README.html

Alternately, you can use a policy service such as postfwd to reject
mail with a combination of sender and recipient.
http://www.postfix.org/SMTPD_POLICY_README.html
http://postfwd.org/




  -- Noel Jones

Reply via email to