Webhosting Blog

Store Copy of Incoming/Outgoing Emails


You can easily monitor the incoming or outgoing emails for all the email accounts for a domain without any BCC entry. You can simply use the following filters for this.
Add following code in the Exim system filter file (/etc/cpanel_exim_system_filter.)

Lets make a backup copy of the current filters so we can restore the same in case if there are issues with the newly configured filters.

# cp -a /etc/cpanel_exim_system_filter /etc/cpanel_exim_system_filter-orig

Assuming that the incoming emails for all the email accounts under the domain and outgoing emails from the email accounts from the domain are stored in different email accounts , we will add 2 different email accounts.
For example:
outgoing@domain.com Will be used to store the outgoing emails from the domain email accounts.
incoming@domain.com Will be used to store the incoming emails for the domain email accounts.

Open the file /etc/cpanel_exim_system_filter and add the following lines at the end of the file:

########### Filter to locate the emails for the domain with fields TO, CC, BCC having the domain name included ###############
if (“$h_to:, $h_cc:, $h_bcc” contains “domain.com”)
then
unseen deliver “incoming@domain.com”
endif

########### Filter to locate the emails sent from the domain ##############
if $sender_address_domain is domain.com
then
unseen deliver “outgoing@domain.com”
endif

Just restart the exim service and now you can get a copy of all the incoming and outgoing emails from the domain .

# service exim restart

In WHM ensure the filters are enabled from Main >> Service Configuration >> Exim Configuration Editor .

You can refer THIS URL to track outgoing emails in cPanel without BCC.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s