Hidden copies of incoming and outgoing emails

Status
Not open for further replies.

phenixak

Member
Dec 3, 2010
10
1
51
Hello

Search on the forum but I have not, so I have a question.

How and where to set:

1. incoming Email on any mail account ([email protected], [email protected], [email protected] etc..) was also sent as a copy at one account: [email protected]
2. Email sent from all accounts was also sent as blind carbon copy to account: [email protected]

All mail accounts are the same user account.

The issue is that You control what emails send and receive its employees.

Best Regards: A. K.
 
  • Like
Reactions: sumun68

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
I'm not entirely certain I understand what you want here. Are you wanting to blind CC all incoming and outgoing emails from any domain to [email protected] account? If that is the case, then I can tell you how to do it on a per domain basis:

1. To create a blind carbon copy, go to /etc/ and create a new file:

Code:
cp cpanel_exim_system_filter cpanel_exim_system_filter2
2. Add the following at the bottom of the new file (/etc/cpanel_exim_system_filter2):

Code:
if ("$h_to:, $h_cc:, $h_bcc" contains "domain.com")
then
  unseen deliver "[email protected]"
endif

if $sender_address: contains "domain.com"
then
unseen deliver "[email protected]"
endif
Now, go to WHM > Exim Configuration Editor and change the system filter to the new path (/etc/cpanel_exim_system_filter2).

Above, please replace domain.com with the domain name you want to have all emails incoming and outgoing sent to the blind carbon copied address. Please ensure the receiving address for the incoming and outgoing emails is not on the same domain as those you are using for the forwarding, since you might end up creating some type of loop otherwise.
 

phenixak

Member
Dec 3, 2010
10
1
51
Thanks for your quick response ,

I mean just a lot of email addresses in the same web account and the same domain that everything will be sent to these email accounts, and every of them will be sent - had hidden copies to [email protected] (owner of the domain and the entire company).

The company's president asked for such a setting to control what employees send out his e-mail accounts and every pick.

So if I understand correctly - is that enough?


///EDIT

Indeed, there I took this into account.

In this case, how to send a hidden copy of incoming messages to the email address[email protected] and outgoing [email protected] address?

The rest remains as I described.


Code:
if ("$h_to:, $h_cc:, $h_bcc" contains "domain.com")
then
  unseen deliver "[email protected]"
endif

if $sender_address: contains "domain.com"
then
unseen deliver "[email protected]"
endif
yes ?
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator

phenixak

Member
Dec 3, 2010
10
1
51
and reproduce this IF statement for each e-mail account in the domain, if necessary? and everything in this file:/etc/cpanel_exim_system_filter2?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
You'd reproduce the if statement for each email account you want this to happen for if you don't simply want all emails on the domain (if you do, then you'd use the previously provided one where it is for all of the domain emails). You'd put each statement you want to add at the bottom of the created cpanel_exim_system_filter2 file.
 

phenixak

Member
Dec 3, 2010
10
1
51
Ok, I'm very grateful for the quick and concrete help. Thank You.

-However, money for Cpanel are easily issued :)

Best Regards: Adam K.
 

phenixak

Member
Dec 3, 2010
10
1
51
Hello Again,

I'm sorry for the hassle but unfortunately it doesn't work.

I did everything as it was written:

-I have a file with the following formula:


Code:
cp cpanel_exim_system_filter cpanel_exim_system_filter2
- At its end there is an entry:

Code:
if ("$h_to:, $h_cc:, $h_bcc" is "domena.pl")
then
  unseen deliver "[email protected]"
endif

if $sender_address is "domena.pl"
then
unseen deliver "[email protected]"
endif
- Then I run the command:

WHM > Exim Configuration Editor and change the system filter to the new path (/etc/cpanel_exim_system_filter2).
..... and in spite of sending emails to addresses in that domain, not the future, no hidden their copy on the defined account for the hidden copies of e-mails.

- Whether something is wrong and understood?


Best Regards: Adam K
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello Adam,

You cannot have is when it is not a full email address as the sender or recipient does not only match "domena.pl" instead it has to be contains for the entries, so you would change these:

Code:
if ("$h_to:, $h_cc:, $h_bcc" is "domena.pl")
then
  unseen deliver "[email protected]"
endif

if $sender_address is "domena.pl"
then
unseen deliver "[email protected]"
endif
To these:

Code:
if ("$h_to:, $h_cc:, $h_bcc" contains "domena.pl")
then
  unseen deliver "[email protected]"
endif

if $sender_address: contains "domena.pl"
then
unseen deliver "[email protected]"
endif
Additionally, please note that I already warned that having the domain have all emails delivering to another email account on the domain might create a loop situation, so I highly suggest picking two email accounts not on the domain for the delivery.
 
  • Like
Reactions: mlopez

phenixak

Member
Dec 3, 2010
10
1
51
Hi,

It works perfectly. E-mail messages started to arrive.. Thank you for help and clarification.

Best Regards: Adam K.
 

m5media

Registered
Feb 8, 2005
1
0
151
hi,

I have almost the same situation, this post is very helpful but I was wondering why create the new filter file and put the rule in there. My current exim filter file has a lot of rules in it and wouldn't those be lost if you started with a blank one?

If you wanted to preserve your existing rules would it be better to just add the new rule to the bottom of the filter file and restart exim?

Regards: Mark P.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
The cPanel filter file will be overwritten on updates. If you add entries to it, then those entries will be lost. Of note, I didn't state to start with a blank filter file. I provided this command initially:

Code:
cp cpanel_exim_system_filter cpanel_exim_system_filter2
This copies the existing filter file to a new filter file. It is not a blank file you would be starting with but the cPanel filter file that you rename by copying it, then putting entries to the bottom of it. If you do not use a filter file copied from the old one, you are going to risk losing your filters. It's up to you.
 

mpkapadia

Active Member
Apr 10, 2002
41
0
306
Hello

This post was extremely helpful in configuring a hidden blind copy for one of our account.
However i have got a request as under

I need a blind copy of every External email ( not of domain.com) that is coming in and going out

That is when sender domain = domain.com and recipient domain NOT = domain.com send blind copy to [email protected]

Also when ("$h_to:, $h_cc:, $h_bcc" contains "domain.com") and when sender NOT = domain.com send blind copy to [email protected]

Is something like the above doable . IF so what filter to set for the same.

Thanks in advance
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,339
75
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hi there Tristan, this was a very interesting post. But I have one question: After doing these changes, the next update will upgrade the cpanel_exim_system_filter only and the second copy will remain untouched? or cpanel will update the filter2 file as this is selected in the Exim Configuration?
In the other hand, when was the last time this file was updated?

Thank you
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
cPanel rarely changes the cpanel_exim_system_filter file, but the new filter file will not be updated upon cPanel updates, since only the cPanel one is going to get updates. Unless the exim version is being changed, it is unlikely the filter file will change in any way. In 11.34, exim will be updated to a newer version, so you may wish to recopy the filter file at that point.

I cannot state the exact time it was last updated. Again, it isn't likely to be changed in any way unless exim were updated, which hasn't happened other than patching for some time.

As for mpkapadia's post, I have no idea how to configure what is being asked. I suggest posting at exim.org for this type of request on their mailing list there.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,339
75
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello Tristan. You still didn't answered the first question: If I set to use the cpanel_exim_system_filter2 file as filter in Exim Configuration, the next time exim has an upgrade, will upgrade the cpanel_exim_system_filter or the cpanel_exim_system_filter2?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
As far as I'm aware, this did answer that question, Kent:

cPanel rarely changes the cpanel_exim_system_filter file, but the new filter file will not be updated upon cPanel updates, since only the cPanel one is going to get updates
No, your new filter file will not be updated and only the cPanel one will be updated. If you create cpanel_exim_system_filter2, that is your file rather than cPanel's filter file. It will not be updated on any updates if cPanel does update the regular cPanel cpanel_exim_system_filter file.
 

Vinayak

Well-Known Member
Jun 27, 2003
288
6
168
Bharat
cPanel Access Level
Root Administrator
While doing this remember that because of any reason if email is rejected by the BCC email address, sender will come to know that their email is being forwarded to some one else too, and this can create a business/legal mess for you.
 
  • Like
Reactions: mlopez

TuskenRaider

Registered
Nov 23, 2011
1
0
51
cPanel Access Level
Root Administrator
I went with what I'm calling the 2nd option which filters certain addresses. I copied the file, cp -p, and put the if statements in at the bottom. When I try to save it in the cpanel it won't accept the new file, saying it's invalid.
 
Status
Not open for further replies.