On Mon, Jul 14, 2025 at 01:36:00PM -0400, Wietse Venema via Postfix-users wrote:
> > Looks very interesting. But unfortunately there's no regexp support
> > available.
> > And the installations of postfix and OS are quite old. Old enough, so that i
> > seriously do not want to touch it as long as the (currently dying) hardware
> > works.
>
> This could also be done with a regexp: table. This use case does
> not require PCRE's expressiveness and speed.
Indeed the RE patterns used are simple (trivial) enough to be portable
across regexp (ARE) and PCRE syntax.
> main.cf:
> regexp = regexp:${config_directory}/
> recipient_bcc_maps = ${regexp}rcpt-bcc.regexp
> bcc_generic_maps = ${regexp}bcc-generic.regexp
I guess, for completeness I should not have neglected:
indexed = ${default_database_type}:${config_directory}/
transport_maps = ${indexed}transport
> transport:
> bcc.invalid bcc:[other.host.example]
>
> master.cf:
> bcc unix - - n - - smtp
> -o { smtp_generic_maps = $bcc_generic_maps }
>
> rcpt-bcc.regexp:
> /^"(.*)"@(.*)$/ "rcpt-bcc-${1}=${2}"@bcc.invalid
> /^(.*)@(.*)$/ rcpt-bcc-${1}=${2}@bcc.invalid
>
> bcc-generic.regexp:
> /^"rcpt-bcc-(.*)=(.*)"@bcc\.invalid$/ "${1}"@${2}
> /^rcpt-bcc-(.*)=(.*)@bcc\.invalid$/ ${1}@${2}
>
> Verified with
>
> postmap -q - 'pipemap:{regexp:rcpt-bcc.regexp,regexp:bcc-generic.regexp}'
>
> for quoted and unquoted localparts.
Perhaps an example, like the above, that puts multiple pieces of the
puzzle together could make a useful addition to ADDRESS_REWRITING_README?
--
Viktor. 🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]