0

essentially we are migrating to Google Apps for Work away from cPanel (centOS5.11 Exim 4.86)

I need to tell Exim:

  1. redirect a list of users to an alternate list of email address
  2. and then use an alternate smarthost only for these redirected emails.

user1@mydomain.com: newuser@mydomain.com.test-google-a.com --> gmail.servers

normally I would have used Forwarders, but the 3rd party spam solution will freak out over the volume (one of many reasons to migrate). I may bypass the spam solution to forward to gmail, but otherwise I am required to send all email through the spam solution for everything that is not migrated.

It is preferable that if a user is on the migration list, it will no longer dump email into their old inbox. I can live with a solution that would still dump into the mailbox if there is no way around it.

Also, not everyone is being migrated in one go, so I will be using the dual delivery setup where the MX records will point to my old machines.

Oh, and yes cPanel is hosting other domains which will not be migrated either.

Does anyone have any solutions or hints?

cheers!

cwheeler33
  • 764
  • 2
  • 5
  • 16

1 Answers1

1

OK, so I came up with a solution that work for me...

For Each User being migarted In cpanel set up the user to be migrated by creating a Forwarder.

One time change: In cPanel go to Home »Service Configuration »Exim Configuration Manager Advanced Editor tab. Go to “Section: PREROUTERS” input box to add

smarthost:
                driver = manualroute
                domains = mydomain.com.test-google-a.com
                unseen
                transport = remote_smtp
                headers_add = X-Custom-Forwarded: true
                condition = ${if match {$h_X-Custom-Forwarded:}{true}{false}{true}}
                route_data = "gmail-smtp-in.l.google.com"

Press the SAVE buttom at the bottom of the page to save and restart Exim.

then we modify the following file (back it up because cPanel updates will overwrite it) vim /etc/cpanel_exim_system_filter

add the following text:

###My Gmail add-in - do not process email a second time

if first_delivery
        and $h_X-Custom-Forwarded contains "true"
then
   seen
   finish
endif

Now all I need to do is delete/rename the old mailbox after the forwarder is setup. All new email will be forwarded to the gmail account. The not so elegant part is that yes, email. will still be dumped into the mailbox if it still exists. But for my use case, the solution is good enough.

cwheeler33
  • 764
  • 2
  • 5
  • 16