BCC to all emails in exim cPanel|Copy all outgoing emails on exim
Date posted: 14-02-2018
In this post, we will explain how to keep all outgoing Emails to particular mail account. Note that the email box which we will be setup will receive all the mails irrespective of to address. So, it would be good if that mail box can have unlimited storage.
- Exim Mailserver
- Email account(used as BCC email)
- Server root access
Login to the server using SSH.
Copy default system filter config file /etc/cpanel_exim_system_filter
cp /etc/cpanel_exim_system_filter /etc/cpanel_exim_system_filter_bcc
Edit the file with the following content.
Open the file /etc/cpanel_exim_system_filter_bcc and add the below content.
if ("$h_to:, $h_cc:, $h_bcc" contains "domain.tld") then unseen deliver "firstname.lastname@example.org" endif if $sender_address: contains "domain.tld" then unseen deliver "email@example.com" endif
Replace the domain.tld with your own domain.
Rebuild the exim configuration.
Restart the exim service.
systemctl restart exim
Verify the log for the domain.tld and we can see sample log file as below which indicates that the mails are being bcc to firstname.lastname@example.org
grep email@example.com /var/log/exim_mainlog
2018-02-14 11:41:35 1elxxxxx -> firstname.lastname@example.org <system-filter> R=smarthost_dkim T=remote_smtp_smart_dkim H=xxxxxx [xx.xx.xx.xx] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes C="250 OK id=1elxxxxx"