On Mon, Jan 08, 2024 at 10:24:15AM +0530, anant--- via Postfix-users wrote:

> For specific 2 recipients of our domain, we don't want always_bcc to be
> implemented.  ie. if a mail is addressed to [email protected]  (our domain only),
> mail should not be Bcc to [email protected]. similarly if mail recipient is
> [email protected] (our domain only), mail should not be Bcc to [email protected].  For
> all others always_bcc to continue.

Suggested approach (this uses "inline" tables, but equivalent file-based
PCRE, or, in the case of the transport(5) table, hash or cdb tables also
work.

    main.cf:
        recipient_delimiter = +
        recipient_bcc_maps = pcre:{
            { /^"(.*)"@example\.com$$/  "bcc+$${1}"@example.com }
            { /^(.*)@example\.com$$/  bcc+$${1}@example.com }
            }
        transport_maps = inline:{
            { [email protected] = discard:silently }
            { [email protected] = discard:silently }
            }

The "$$" syntax is only needed for inline tables in main.cf, just a
single "$" is needed in  a file-based PCRE table

    rcpt-bcc.pcre:
        /^"(.*)"@example\.com$/  "bcc+${1}"@example.com
        /^(.*)@example\.com$/  bcc+${1}@example.com

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to