On 9/24/2014 12:49 PM, Michael Fox wrote: >> -----Original Message----- >> From: owner-postfix-us...@postfix.org [mailto:owner-postfix- >> us...@postfix.org] On Behalf Of Michael Fox >> Sent: Wednesday, September 24, 2014 10:24 AM >> To: 'postfix users' >> Subject: RE: header checks for a relay client >> >>>> 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 >> >> I don't see how this addresses the problem of rejecting messages that are >> both: >> -- From: a certain address (or domain), and >> -- To: a certain address (or domain). >> >> For example, I'd like to block messages if: >> The sender matches /.*@yahoogroups\.com/ >> -and- >> The recipient matches /.*@client[1-6]\.domain2\.com/ >> >> Would you be so kind as to provide an example? >> >> Thanks much, >> Michael > > I really could use more examples in the documentation to help me synthesize > how all the parts fit together. But I'm trying. Would the following work? > > main.cf: > smtpd_recipient_restrictions = > check_recipient_access > pcre:/etc/postfix/no_yahoo_groups_recipients.pcre > > > smtpd_restriction_classes = reject_yahoo_groups_sender > reject_yahoo_groups_sender = check_sender_access > pcre:/etc/postfix/reject_yahoo_groups_sender.pcre > > > /etc/postfix/no_yahoo_group_recipients.pcre: > /client[1-6]\.domain2\.com/ reject_yahoo_groups_sender > > > /etc/postfix/reject_yahoo_groups_sender.pcre > /@yahoogroups\.com/ REJECT > > > Michael > > > >
That looks about right. Good Practice Note: anchor/narrow your expressions to make them as specific as possible to prevent unexpected behavior. This is especially important if you intend to discard mail: /@client[1-6]\.domain2\.com$/ /@yahoogroups\.com$/ -- Noel Jones