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

We have in main.cf always_bcc = zz...@xx.com 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 a...@xx.com  (our domain only), mail should not be Bcc to zz...@xx.com. similarly if mail recipient is d...@xx.com (our domain only), mail should not be Bcc to zz...@xx.com.  For all others always_bcc to continue.

So, in summary, main.cf

always_bcc = zz...@xx.com
recipient_bcc_maps=regexp:/etc/postfix/regexp_recipient_bcc


#regexp_recipient_bcc

#/etc/postfix/regexp_recipient_bcc

a...@xx.com    a...@xx.com
d...@xx.com    d...@xx.com

Whether the above configuration will enable to get desired results? ie. always_bcc should not work for a...@xx.com and d...@xx.com and instead the mails are delivered to a...@xx.com and d...@xx.com 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 a...@xx.com and d...@xx.com and still get all mails copied to zz...@xx.com without achieving the aim because the copy will alzo go to zz...@xx.com 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

a...@xx.com    devnull
d...@xx.com    devnull
@xx.com    zz...@xx.com

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 -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to