On Wed, Aug 10, 2011 at 09:47:37AM +0200, Jeroen Geilman wrote: > On 2011-08-10 09:20, Troy Piggins wrote: <snip /> > >1. Could you please confirm that the pattern between the slashes is just the > >sender's address that we're trying to match? > > sender_bcc_maps matches the envelope sender address. > > > At first I tried doing a full > >header match like /^From:.*@mydomain.com/ but it didn't seem to be working > >correctly. Not sure if that was my pattern or because it was looking for a > >sender with From etc in the address. > > The envelope sender is not a header.
Ah, I see now. Thankyou for clearing that up. > >2. Can you recommend a better or more elegant solution to the second part of > >the table with the /us...@mydomain.com/ etc? I tried using something like > >this: > > > >/(user1)@mydomain.com/ \1_s...@mydomain.com > > > >but it occurred to me that the variable \1 to the right is probably not > >recognised outside the actual pattern within the //. Correct? > > It is not a variable expansion. Use this instead: > > /(user1)@mydomain.com/ $1_s...@mydomain.com > > Read http://www.postfix.org/pcre_table.5.html, section Text Substitution for > details. > > Note that this offers zero advantage over an exact match. Thankyou! That works. I now have this and it seems to be working fine: if !/^(excludeduser1|root|.+_sent)@mydomain\.com$/ /^(.+)@mydomain\.com$/ ${1}_s...@mydomain.com endif > >3. Do you think I'm on the right track? Mostly in terms of using pcre for > >the > >table. Wasn't sure whether this or regex would be better? > > I would probably use regexp tables; it's a matter of preference > mostly, although the documentation says PCRE is usually faster. > > >4. Any other suggestions/advice? > > The easiest way to prevent matching the archive sender address on > mail you do not wish to archive is not to use that address as a > sender, ever. > Use something like archive-from@; use your imagination. Thankyou for the help and suggestions. WIll look into that.