On Sat, Feb 07, 2026 at 04:27:05PM +0100, Michael Grimm via Postfix-users wrote:

> 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,
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.

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to