Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot autodiscover Office365 @domain.onmicrosoft.com emails #6

Open
akshayrawat opened this issue Apr 28, 2016 · 2 comments
Open

Cannot autodiscover Office365 @domain.onmicrosoft.com emails #6

akshayrawat opened this issue Apr 28, 2016 · 2 comments

Comments

@akshayrawat
Copy link

Exchange emails for an Office 365 setup with no custom domain are of the format [email protected]. The gem incorrectly tries to find the autodiscovery URL at domain-name.onmicrosoft.com.

@martini
Copy link

martini commented Jul 19, 2017

Same here, the reason is that the autodiscover gem tries to probe the following urls:

  1. https://znuny.onmicrosoft.com/autodiscover/autodiscover.xml
    -=> Unfortunately Microsoft is not serving AAA records for this kind of sub domains, so the autodiscover gem dies with "SocketError" and is stopping probing

  2. After modify in autodiscover gem to not stop, it tries https://autodiscover.znuny.onmicrosoft.com/autodiscover/autodiscover.xml
    -=> Unfortunately Microsoft (ans also other hosted exchange provider) are not serving https resources for that, only http resources. Anyway, the autodiscover gem dies with " Errno::EHOSTUNREACH" because "https://autodiscover.znuny.onmicrosoft.com/autodiscover/autodiscover.xml" is returning with connection refused.

Solution: Microsoft and other hosted exchange providers serving non https resources like "http://autodiscover.znuny.onmicrosoft.com/autodiscover/autodiscover.xml" which do an redirect to correct https resource, in this case to https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml which is returning the EWS URL correctly "https://outlook.office365.com/EWS/Exchange.asmx".

So the autodiscover gem need to get improved to handle autodiscover this way.

@thorsteneckel
Copy link

I created the pull request #9 for fixing this issue based on the work of @martini this morning. If the newly added exceptions get skipped the gem actually tries requests for the http domain:

available_urls gets looped:

available_urls.each do |url|

available_urls yields the redirected_http_url after the HTTPS tries failed:

yield redirected_http_url

The 302 Location header is used if present:

(response.status == 302) ? response.headers["Location"] : nil

So there is no need to add the HTTP requests. They just were never executed before because of the unhandled exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants