{"id":158,"date":"2011-11-24T10:27:00","date_gmt":"2011-11-24T10:27:00","guid":{"rendered":"http:\/\/pheonixsolutions.com\/?p=158"},"modified":"2026-05-09T09:08:00","modified_gmt":"2026-05-09T03:38:00","slug":"cpanel-exim-forward-outgoing-mail-to-another-mail","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/cpanel-exim-forward-outgoing-mail-to-another-mail\/","title":{"rendered":"cPanel + Exim \u2013 Forward Incoming and Outgoing Emails to Another Mail Account"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">cPanel and Exim allow administrators to configure advanced email routing and filtering options. One such configuration is creating a blind carbon copy (BCC) of all incoming and outgoing emails for a specific domain and forwarding them to another email address.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This setup is useful for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Email monitoring and archiving<\/li>\n\n\n\n<li>Backup of business communications<\/li>\n\n\n\n<li>Compliance and auditing purposes<\/li>\n\n\n\n<li>Centralized email tracking<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to configure Exim in cPanel\/WHM to forward copies of all incoming and outgoing emails for a domain to another mailbox.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding, ensure you have the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Root or sudo access to the server<\/li>\n\n\n\n<li>WHM administrative access<\/li>\n\n\n\n<li>cPanel server with Exim installed<\/li>\n\n\n\n<li>Basic knowledge of Linux command line<\/li>\n\n\n\n<li>A destination email account for receiving forwarded copies<\/li>\n\n\n\n<li>SSH access to the server<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Important:<\/strong><br>The destination email address should NOT belong to the same domain being monitored. Otherwise, it may create a mail forwarding loop.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Steps to Configure Email Forwarding in Exim<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Create a Copy of the Existing Exim System Filter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Login to the server via SSH and navigate to the <code>\/etc\/<\/code> directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cp \/etc\/cpanel_exim_system_filter \/etc\/cpanel_exim_system_filter2\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This creates a backup copy of the current Exim system filter configuration.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Edit the New Exim System Filter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open the newly created filter file using a text editor such as <code>nano<\/code> or <code>vi<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano \/etc\/cpanel_exim_system_filter2\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following lines at the bottom of the file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if (\"$h_to:, $h_cc:, $h_bcc\" contains \"domain.com\")\nthen\nunseen deliver \"user@domain.com\"\nendif\n\nif $sender_address: contains \"domain.com\"\nthen\nunseen deliver \"user@domain.com\"\nendif\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Replace Domain and Email Address<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Update the following values:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Placeholder<\/th><th>Replace With<\/th><\/tr><\/thead><tbody><tr><td><code>domain.com<\/code><\/td><td>Your domain name<\/td><\/tr><tr><td><code>user@domain.com<\/code><\/td><td>Destination email address<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if (\"$h_to:, $h_cc:, $h_bcc\" contains \"example.com\")\nthen\nunseen deliver \"backupmail@gmail.com\"\nendif\n\nif $sender_address: contains \"example.com\"\nthen\nunseen deliver \"backupmail@gmail.com\"\nendif\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Update Exim Configuration in WHM<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Login to WHM<\/li>\n\n\n\n<li>Navigate to:<br><strong>WHM \u2192 Exim Configuration Manager \u2192 Advanced Editor<\/strong><\/li>\n\n\n\n<li>Locate the <strong>System Filter File<\/strong><\/li>\n\n\n\n<li>Change the path to:<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/etc\/cpanel_exim_system_filter2\n<\/pre>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Save the configuration<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Restart Exim Service<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the Exim mail service for changes to take effect.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/scripts\/restartsrv_exim\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">or<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl restart exim\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Verification<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After configuration:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Send a test email to the monitored domain<\/li>\n\n\n\n<li>Send an outgoing email from the monitored domain<\/li>\n\n\n\n<li>Verify that copies are received at the destination email account<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Important Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>unseen deliver<\/code> option sends a copy without affecting normal mail delivery.<\/li>\n\n\n\n<li>Always keep a backup of the original Exim filter file before making changes.<\/li>\n\n\n\n<li>Incorrect filter syntax may stop Exim mail processing.<\/li>\n\n\n\n<li>Avoid forwarding to the same domain to prevent infinite mail loops.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Using Exim system filters in cPanel\/WHM, administrators can configure automatic blind copies of all incoming and outgoing emails for a specific domain. This setup is useful for monitoring, auditing, and maintaining email backups while ensuring original mail delivery remains unaffected.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction cPanel and Exim allow administrators to configure advanced email routing and filtering options. One such configuration is creating a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2y","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":10161,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/158\/revisions\/10161"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}