Exim Smart Host with Office 365 Exchange
I have been attempting to solve an issue, slowly driving myself insane in the process.
I have email accounts hosted on both Office 365 Exchange and cPanel centos, which utilize the same domain.
My MX record points to exchange. cPanel is set as a smart host for the domain. So, mail first hits exchange, if no matching account or alias, the message is forwarded to cpanel. The domain MX is set up as "Backup Mail Exchanger" within cpanel. This is where it gets tricky.
As an aside, to be reference momentarily, I have the following router configured within Exim, the first router in the list:
office365exchange:
driver = dnslookup
domains = +office365_domains
ignore_target_hosts = +loopback : 64.94.110.0/24
headers_add = "${perl{mailtrapheaders}}"
#condition = ${if eq {$received_protocol}{local}}
#condition = ${if or {{match_ip{$sender_host_address}{+loopback}}{eq{$received_protocol}{local}}}{true}{false}}
#condition = ${if or {{match_ip{$sender_host_address}{+office365EOPips}}{eq{$received_protocol}{local}}}{true}{false}}
condition = ${if ! match_ip{$sender_host_address}{+office365EOPips}}
#condition = ${if ! def:header_X-Mail-TouchedByExchange{$h_X-Mail-TouchedByExchange}}
#headers_add = X-Custom-Forward-remote: true
#condition = ${if match {$h_X-Custom-Forward-remote:}{true}{false}{true}}
transport = remote_smtp
My thought here is if mail is to domain listed in specified file, and not from an office365 masked server ip address, route remotely, back to exchange server. This solves sending mail from an internal cpanel account, to an address which may be hosted on exchange. This works. Sending mail from an external account (ie. gmail account) to an address either hosted on exchange or cpanel works.
What does not work, at least from discovery thus far, is cpanel mail forwarders. A mail loop always occurs. What appears to happen is that a mail sent to bk@mydomain.com first hits exchange, account does not exist, forwarded to cpanel, matches cpanel rule, but on redirect the "To" recipient is not changed, so looped back to exchange->cpanel->repeat..
Can anyone offer some assistance in setting up cpanel as a smart host, allowing all cpanel functionality, alongside remote accounts hosted on exchange?
Thank you!!
-
Hello :) You may receive more user-feedback on the Exim users mailing list if you are unable to receive a response from other users with a similar configuration. Please update this thread with the outcome should you find a resolution. Thank you. 0 -
Hello i been having a issue which is a like, i have the same configuration, office 365 and exim server, my Mx records points to Exchange but i do not have that route configured, so when i sent a email from internet (gmail, hotmail) to an address that is hosted in exim it returns an error (error 550 authentication required) so i think is a ACL or condition in my exim.conf file, did you solve the problem benjam1nk 0
Please sign in to leave a comment.
Comments
2 comments