Score:0

exim4: how to add an address as BCC to all the outgoing emails?

us flag

I'm working on an Ubuntu 20.04 web server where exim4 is used to send emails from the PHP application running on it.

Due to diagnostic and archival needs, I need to configure exim4 to automatically BCC an additional address to ALL the outgoing emails.

TO be cleared: all the original recipients of the outgoing email must remain the same. I just need to add my additional [email protected] address to the list (as BCC).

My exim4 skill are near-zero (I generally use postfix), so please behave ;-).

I tried to follow along this post, but nothing happens. I don't have a /etc/exim/exim.conf (most likely due to the "split configuration" mode of exim4) so I created a new file in /etc/exim4/conf.d/main/nano 95_zane with this:

system_filter = /etc/exim4/exim.filter

Then I created /etc/exim4/exim.filter:

if first_delivery
   and ("$h_to:, $h_cc:, $h_bcc" not contains "example.com")
   and ("$h_from:" not contains "example.com")
then
   unseen deliver "[email protected]"
endif

I restarted exim4 and re-tried, but nothing happens: the intended recipient gets the message, but my additional address is not BBC'ed.

Thanks for your help!

Score:0
us flag

Got it! I just had to add system_filter = /etc/exim4/exim.filter directly a the top of /etc/exim4/exim4.conf.template and now it works as expected.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.