The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exim Smart Host with Office 365 Exchange

Discussion in 'E-mail Discussions' started by benjam1nk, Aug 27, 2015.

  1. benjam1nk

    benjam1nk Registered

    Joined:
    Aug 27, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Cleveland, Ohio
    cPanel Access Level:
    Root Administrator
    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!!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  3. ajnv15

    ajnv15 Registered

    Joined:
    Nov 19, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Mexico
    cPanel Access Level:
    Root Administrator
    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
     
Loading...

Share This Page