On 08/01/2024 05:54, anant--- via Postfix-users wrote:
Hello,

We have in main.cf always_bcc = [email protected] and our domain is xx.com

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.

So, in summary, main.cf

always_bcc = [email protected]
recipient_bcc_maps=regexp:/etc/postfix/regexp_recipient_bcc


#regexp_recipient_bcc

#/etc/postfix/regexp_recipient_bcc

[email protected]    [email protected]
[email protected]    [email protected]

Whether the above configuration will enable to get desired results? ie. always_bcc should not work for [email protected] and [email protected] and instead the mails are delivered to [email protected] and [email protected] only.

H Anant

I don't think that will work: if you try it I think you will find you get two copies of the email to [email protected] and [email protected] and still get all mails copied to [email protected] without achieving the aim because the copy will alzo go to [email protected] i.e. these are all cumulative configurations.

You will need to eliminate the always_bcc configuration since you don't always want all email to be bcced. You should only have the recipient_bcc_maps configured.

Since this map is searched according to the search order indicated here https://www.postfix.org/postconf.5.html#recipient_bcc_maps you could try to map the more specific addresses to /dev/null and have a domain wide bcc for the rest.

In order to do it and depending on how your domains are configured you might need a local alias in the aliases file to send mail to /dev/null file, e.g.

devnull:    /dev/null

Then you can use that as bcc destination for those addressed that should skip bcc copies.

#/etc/postfix/regexp_recipient_bcc

[email protected]    devnull
[email protected]    devnull
@xx.com    [email protected]

Postfix will still generate bcc messages for emails to abc and def but they won't actually get sent out.

best regards

John

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

Reply via email to