Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Relay SMTP messages to Office 365 / Smart Host

Discussion in 'E-mail Discussion' started by infocenter, Sep 7, 2018.

Tags:
  1. infocenter

    infocenter Member

    Joined:
    Feb 28, 2014
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Reseller Owner
    I can assure you that I have investigated this topic for hours before posting here. So here is so far what I have found:

    Set up connectors to route mail between Office 365 and your own email servers

    The office365 to our VPS connector is setup properly and we get emails to our VPS (on our WHM/cPanel).

    We are now trying to setup the smart host so all the emails are routed / relayed to microsoft office 365 and then is sent through them. We have also created the inbound connectors per Microsoft suggestion (above link)

    We tried Exim Configuration Manager>>Smarthost support>>

    and we used *.protection.outlook.com or *.office365.com

    nothing worked and our emails are bounced when we try to send emails from our VPS (cPanel).

    Is there anyone who has successfully setup a connector for Micorosoft 365 and split the emails between exchange and WHM?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,937
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @infocenter,

    Can you let us know the specific bounce message that you receive? Also, can you check if Local Mail Exchanger is configured for the domain you are testing with in cPanel >> Email Routing?

    Also, while the setup is different to yours, you may find some of the discussion in the following thread helpful:

    Using cPanel and Office 365 in a hybrid scenario

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. infocenter

    infocenter Member

    Joined:
    Feb 28, 2014
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Reseller Owner
    Email routing is set to "Automatic - Local" the bounce email message is as follows. The discussion you suggested goes back to 2011! Office 365 has changed a lot since then. However we have followed what has been suggested on the discussion. As mentioned we don't have any issue receiving emails. But we have the problem of sending out emails when Smart Host option is set.

    _________________________________________________________
    Code:
    
    Return-Path: <>
    Delivered-To: test@mydomain.com
    Received: from myhostname.com
            by myhostname.com with LMTP id oHBLF2IzmFuMaQAAVoenzA
            for <test@mydomain.com>; Tue, 11 Sep 2018 16:28:02 -0500
    Return-path: <>
    Envelope-to: test@mydomain.com
    Delivery-date: Tue, 11 Sep 2018 16:28:02 -0500
    Received: from mailnull by myhostname.com with local (Exim 4.91)
            id 1fzqCY-00071d-Ah
            for test@mydomain.com; Tue, 11 Sep 2018 16:28:02 -0500
    X-Failed-Recipients: ValidGmailAddress@gmail.com
    Auto-Submitted: auto-replied
    From: Mail Delivery System <Mailer-Daemon@myhostname.com>
    To: test@mydomain.com
    Content-Type: multipart/report; report-type=delivery-status; boundary=1536701282-eximdsn-780460104
    MIME-Version: 1.0
    Subject: Mail delivery failed: returning message to sender
    Message-Id: <E1fzqCY-00071d-Ah@myhostname.com>
    Date: Tue, 11 Sep 2018 16:28:02 -0500
    --1536701282-eximdsn-780460104
    Content-type: text/plain; charset=us-ascii
    This message was created automatically by mail delivery software.
    A message that you sent could not be delivered to one or more of its
    recipients. This is a permanent error. The following address(es) failed:
      ValidGmailAddress@gmail.com
        The mail server could not deliver mail to
    OLE_LINK13">ValidGmailAddress@gmail.com.  The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.
    --1536701282-eximdsn-780460104
    Content-type: message/delivery-status
    Reporting-MTA: dns; myhostname.com
    Action: failed
    Final-Recipient: rfc822;ValidGmailAddress@gmail.com
    Status: 5.0.0
    --1536701282-eximdsn-780460104
    Content-type: message/rfc822
    Return-path: <test@mydomain.com>
    Received: from [::1] (port=58240 helo=myhostname.com)
            by myhostname.com with esmtpa (Exim 4.91)
            (envelope-from <test@mydomain.com>)
            id 1fzqCY-00070Z-72
            for ValidGmailAddress@gmail.com; Tue, 11 Sep 2018 16:28:02 -0500
    MIME-Version: 1.0
    Content-Type: text/plain; charset=US-ASCII;
    format=flowed
    Content-Transfer-Encoding: 7bit
    Date: Tue, 11 Sep 2018 16:28:02 -0500
    From: test@mydomain.com
    To: ValidGmailAddress@gmail.com
    Subject: Testing Emails
    Message-ID: <595aedc8a45f5d59bd782b302c4cdbd4@domain.tld>
    X-Sender: test@mydomain.com
    User-Agent: Roundcube Webmail/1.3.3
    Test Message
    --1536701282-eximdsn-780460104--
     
    #3 infocenter, Sep 11, 2018
    Last edited by a moderator: Sep 11, 2018
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,937
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @infocenter,

    Can you also let us know the output from /var/log/exim_mainlog when sending a message? EX:

    Code:
    exigrep SUBJECT /var/log/exim_mainlog
    Additionally, have you tested sending out email to other remote destinations aside from Gmail?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. infocenter

    infocenter Member

    Joined:
    Feb 28, 2014
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Reseller Owner
    Here is the log. Also we tried other email addresses like those on Microsoft , Yahoo, and others and the email bounces immediately. Per Microsoft Smart Host should be set to smtp.office365.com
    Code:
    [root@hostname without main domain ~]# exigrep OutgoingcPanelTest1 /var/log/exim_mainlog2018-09-12 21:09:22 1g0H4M-0008Mb-CE <= test@mydomain.com H=(Hostname) [::1]:48430 P=esmtpa A=dovecot_login:test@mydomain.com S=645 id=4cab8f9eb0787e243162b5b1fb8bd227@mydomain.com T="OutgoingcPanelTest1" for ValidGmailAddress@gmail.com
    
    2018-09-12 21:09:22 1g0H4M-0008Mb-CE Sender identification U=mydomain D=mydomain.com S=test@mydomain.com2018-09-12 21:09:22 1g0H4M-0008Mb-CE SMTP connection outbound 1536804562 1g0H4M-0008Mb-CE mydomain.com ValidGmailAddress@gmail.com
    
    2018-09-12 21:09:22 1g0H4M-0008Mb-CE ** ValidGmailAddress@gmail.com R=fail_remote_domains: The mail server could not deliver mail to ValidGmailAddress@gmail.com. The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.
    
    2018-09-12 21:09:22 1g0H4M-0008Mb-CE Completed
    
    
     
    #5 infocenter, Sep 12, 2018
    Last edited by a moderator: Sep 12, 2018
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,937
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @infocenter,

    Could you open a support ticket so we can take a closer look and see if there's anything obvious in your configuration that's causing this problem? You can post the ticket number here and we'll link this thread to the ticket.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. infocenter

    infocenter Member

    Joined:
    Feb 28, 2014
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Reseller Owner
    Our support request ID is 10298351
     
    cPanelMichael likes this.
  8. infocenter

    infocenter Member

    Joined:
    Feb 28, 2014
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Reseller Owner
    So the issue is resolved (almost-read the notes below). For those of you who might be interested this is how it got resolved (thanks cPanel Support :) )

    Step 1)
    Email Routing is set to "Local"

    Step 2) Go to your Microsoft Office 365 Admin portal and setup your connectors ( See this: Set up connectors to route mail between Office 365 and your own email servers)

    Note: For the Inbound Connector you should use your VPS IP address. We tried using the domain but it didn't work. So use the VPS IP address. Just remember; that needs to be a dedicated IP (per their instructions).

    Step 3) Go to your WHM>> Exim Configuration Manager>>Mail>>Smarthost Support

    Change the setting of Smarthost Support to * mydomain-com.mail.protection.outlook.com


    Some notes:

    A) Consider the * and space between * and the domain. That was the issue we had so make sure to use * yourdomain-com.mail.protection.outlook.com

    B) Remember it's not a dot between yourdomain and com. It's a dash line. yourdomain-com not "yourdomain.com"

    C) We rebooted our whole VPS once even though rebooting Exim should be enough but it worked after full VPS reboot.

    I hope this post helps other.

    Just FYI Final Note:

    This solutions is not perfect. Here is the issue.

    Scenario: mydomain1.com and mydomain2.com are hosted both on the same VPS. For both domains some emails are hosted locally (on VPS) and some on Microsoft Exchange. For example, email1@mydomain1.com resides on VPS but email2@mydomain.com is on Microsoft Exchange. But because the email routing is set to Local (remember Step 2? It won't work if you don't set it to local) then VPS just tries to send the emails to local which means it only tries to send the email only to local so if that user doesn't exist on the VPS but on microsoft exchange you will receive a bounced email. We are working on a solution for that but at least this is a temporary solution for the above issue.
     
    cPanelMichael likes this.
  9. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,937
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @infocenter,

    Thanks for sharing! We'll look forward to seeing what you find regarding the per-email account configuration. Note that we have had some threads about that in the past, but I'm not sure it would help in your particular scenario. Here's the link if you're interested:

    Routing email to external server using EXIM smarthost config.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice