Viktor Dukhovni via Postfix-users <[email protected]> wrote: > On Sat, Feb 07, 2026 at 04:27:05PM +0100, Michael Grimm via Postfix-users > wrote:eede
>> But, dbmail-lmtp:[10.0.1.11]:24 is delivering to [email protected] >> <mailto:[email protected]> and not my final destination at dmail >> which is [email protected] <mailto:[email protected]> > > If you absolutely hate explicit per-user 1-to-2 virtual alias rewrites, No, I really don't ;-) Unix little helpers made that in minutes. My rationale was simply: Make the configuration as effortless as possible, because this dual delivery was meant to be a short term approach until I will have decided about which IMAP server to go. > you can get fancy with recipient bcc mappings and smtp_generic_maps > (which, for the record, also affect header addresses, there is no > smtp_generic_classes): > > main.cf: > # Need "$$" in place of "$" to handle parameter value expansion > recipient_bcc_maps = pcre:{ > { /"(.*)"@(demo\.example)$$/ "bcc=$${1}"@db.$${2} }, > { /(.*)@(demo\.example)$$/ bcc=$${1}@db.$${2} } } > > # Possibly as an override for a single transport: > smtp_generic_maps = pcre:{ > { /^"bcc=(.*)"@db\.(demo\.example)$$/ "$${1}"@$${2} } > { /^bcc=(.*)@db\.(demo\.example)$$/ $${1}@$${2} } } > > Demo (now just single '$', no longer in main.cf): > > $ printf '%[email protected]\n"%s"@demo.example\n' foo "foo bar" | > postmap -q - 'pcre:{ > { /"(.*)"@(demo\.example)$/ "bcc=${1}"@db.${2} }, > { /(.*)@(demo\.example)$/ bcc=${1}@db.${2} } }' > [email protected] [email protected] > "foo bar"@demo.example "bcc=foo bar"@db.demo.example > > $ printf 'bcc=%[email protected]\n"bcc=%s"@db.demo.example\n' foo "foo > bar" | > postmap -q - 'pcre:{ > { /^"bcc=(.*)"@db\.(demo\.example)$/ "${1}"@${2} } > { /^bcc=(.*)@db\.(demo\.example)$/ ${1}@${2} } }' > [email protected] [email protected] > "bcc=foo bar"@db.demo.example "foo bar"@demo.example > > Only downside is that any headers with "db.demo.example" also get > rewritten by smtp_generic_maps. Wow. That's gorgeous and a real regex gem in my point of view. It took me a while to comprehend. I do really want to thank you for your efforts. I learned a lot. But, as mentioned above, I will keep it simple and thus I will stick to my virtual_alias_maps approach. Thanks and regards, Michael _______________________________________________ Postfix-users mailing list -- [email protected] To unsubscribe send an email to [email protected]
