We've got an unusual mail setup - Google Apps/Gmail in front, with Exim running on our webserver. Mail for any account that doesn't exist in Google Apps is forwarded to Exim. Both of these use the same domain.
Problem is, all mail sent from the Exim accounts (or our PHP app) is only delivered locally, not sent through Gmail.
To perhaps illustrate it better, see this high-quality chart:
[Google Apps] (Tom, Dick, Harry)
|
v
[Exim] (Jane, Mary, Sue)
Mail sent to Jane gets forwarded to Exim by Google. Mail sent to Tom is simply delivered by Google. This is the part that works - the problem is, Jane can't email Tom because as far as Exim is concerned, it runs the whole show.
I'm reading about setting up a SmartHost in Exim, but that requires authentication - and critically, the accounts in Exim do not match those in Apps.
How can I configure Exim to deliver local mail via external routes?
Based on the answer you referenced in the comments of the question (Configure server to foward unroutable emails to another email server), I rewrote the logic part to use the whole email address, not just the local part. The following seems to work in my testing.
1) Put example.com in your +local_domains.
2) Add the router he recommended. (There should be another router following this one that accepts +local_domains and users that do have valid local mailboxes) :
3) Create
/etc/exim/forward_to_google
and put in it:4) You can test with exim's -bt address test option (my config doesn't have that second router for the valid local users, but yours should so the first user would show a local delivery):