On Tue, Oct 20, 2020 at 03:08:51PM -0600, @lbutlr wrote: > I would like to change this to only bcc mail that is being delivered > to local users. > > The current setup uses recipient_bcc_maps which I would have thought > did what I wanted, but it actually does all outbound mail as well.
With recipient_bcc_maps, the specified BCC recipient from the RHS of the table is added whenever the message envelope contains a recipient that matches the LHS of the table. Therefore, either the outbound mail in question also had local recipients, or your table inadvertently matches some or all remote recipients. > The pcre file for the map is generated each date: > > #!/bin/bash > > JDATE=$(gdate +%j) > cat << EOF > /etc/postfix/rbcc.pcre > if !/backup.*@/ > /^([^+_]*).*@([^.]*)/ backup+${JDATE}.\${1}-\${2}@southgaylord.com > endif I don't see anything above that limits the matched recipients to local users. Do you? What is the intent of the "([^.]*)" pattern following the "@" sign? It will always match, possibly an empty string if the first character after "@" is ".", but otherwise some initial substring of the domain part. This also misparses quoted local parts with an address extension: "user+foo..bar"@example.com will result in $1 = '"user' and $2 = 'example', which produces a malformed RHS address with just one bare '"'. You'd typically want to match quoted forms explicitly before falling back to matching unquoted forms: /"..."@.../ ... /...@.../ ... Also, if you're then using the address extension to create filenames, I'd want to exclude more characters from $1 and $2. Bottom line, regular expressions are power tools with no safety measures, they cut fingers as well as they cut wood. My advice would be to stick to indexed tables whenever possible. > So, what would I need to do/change so that message I send to this list > )for example) are not archived, but the messages received from the > list continue to be archived to the backup user? Create an indexed table that only matches local addresses. -- Viktor.