Email Archiving in cPanel

If you’re interesting in saving a copy of all incoming and outgoing mail for a particular domain, look no further! This can be expanded to include all domains on the server or other stipulations, but I am going to include the config for a single domain. First we’ll need to make a copy of the existing cPanel Exim filter so our rules don’t get overwritten by cPanel, so get into the shell as root and get started.

# cp -a /etc/cpanel_exim_system_filter /etc/cpanel_exim_system_filter_modified

In this new file, insert the following at the bottom, modifying to the domain of your choosing and the email addresses appropriately as well:

#Incoming/Outgoing Email Archiving if ("$h_to:, $h_cc:, $h_bcc" contains "") then unseen deliver "" endif if $sender_address_domain is then unseen deliver "" endif

Finally, we need to modify the default Exim filter file in the WHM so that this new file is used. Go to Main >> Service Configuration >> Exim Configuration Editor and modify the System Filter File line to reflect the new filename; save. The last step of course is to create the email accounts specified above if you’ve not already done so!

Email Archiving in cPanel

Leave a Reply

Your email address will not be published. Required fields are marked *

Fork me on GitHub