Hello,
We are posting this here in case it helps someone. With a few config changes on exim you can redirect your messages to an external server while keeping a copy locally.
First thing is to add a route for it.
Go to WHM -> Exim Configuration Editor -> Advanced Editor. Search for "ROUTERS CONFIGURATION" and add the following text on the textarea below it:
In this case, we are redirecting all message sent to yourdomain.com to google's server. Change it according to your needs.
After that, you have to create a system filter. Create file /etc/custom_cpanel_exim_system_filter ( by default Cpanel use /etc/cpanel_exim_system_filter but upcp usually overwrites it when a new version is out ) and add this:
This filter is necessary to avoid infinite loops in case the other email server is also redirecting back to you.
Now, go to WHM -> Exim Configuration Editor -> search for filter add edit System Filter File to point to /etc/custom_cpanel_exim_system_filter.
Save the new configuration and you are done.
Note: watch exim log to make sure everything is working fine.
In case something went wrong, you can always revert things by removing the changes on /etc/exim.conf.local and running /scripts/buildeximconf to build a new configuration. Don't forget to restart exim.
Hope it helps someone.
We are posting this here in case it helps someone. With a few config changes on exim you can redirect your messages to an external server while keeping a copy locally.
First thing is to add a route for it.
Go to WHM -> Exim Configuration Editor -> Advanced Editor. Search for "ROUTERS CONFIGURATION" and add the following text on the textarea below it:
Code:
smarthost:
driver = manualroute
domains = yourdomain.com
unseen
transport = remote_smtp
headers_add = X-Custom-Forwarded: true
condition = ${if match {$h_X-Custom-Forwarded:}{true}{false}{true}}
route_data = "aspmx.l.google.com"
After that, you have to create a system filter. Create file /etc/custom_cpanel_exim_system_filter ( by default Cpanel use /etc/cpanel_exim_system_filter but upcp usually overwrites it when a new version is out ) and add this:
Code:
if first_delivery
and $h_X-Custom-Forwarded contains "true"
then
seen
finish
endif
Now, go to WHM -> Exim Configuration Editor -> search for filter add edit System Filter File to point to /etc/custom_cpanel_exim_system_filter.
Save the new configuration and you are done.
Note: watch exim log to make sure everything is working fine.
In case something went wrong, you can always revert things by removing the changes on /etc/exim.conf.local and running /scripts/buildeximconf to build a new configuration. Don't forget to restart exim.
Hope it helps someone.
Last edited: