linagora / james-project

Mirror of Apache James Project
Apache License 2.0
72 stars 62 forks source link

Auto-configuration for Outlook #4809

Closed chibenwa closed 1 year ago

chibenwa commented 1 year ago

CF https://docs.directadmin.com/other-hosting-services/email/autodiscover.html

Have a docker container serving the above PHP file.

Une environment variable for IMAP and SMTP host name.

Then complete https://github.com/linagora/james-project/tree/master/examples/imap-autoconf

quantranhong1999 commented 1 year ago

TLDR: Local auto-conf does not work with XML file, but somehow auto-configuration already works for our linagora.com.

Auto-configuration for local server

Reading other docs, they say we just need either the SRV record or the XML file:

I tried setup a local IMAP server with a static Outlook autoconf format XML file served at GET /autodiscover/autodiscover.xml, but Outlook autoconf does not work. It even gives us no chance to do auto-conf (Wiresharked and see no request to the XML file):

https://github.com/linagora/james-project/assets/55171818/7d9abf5d-ab78-4918-a154-44160ab6135f

If I choose to connect to Exchange servers, Outlook does ask for the XML file: Image But then nothing else, guess that because our mail is not Exchange server compliance.

I Wiresharked the Outlook machine and see Outlook ask the Autoconf service of MS at prod-global-autodetect.acompli.net. I guess that is why even if I bypass the local machine hosts file, the autoconfiguration still gives us no chance, as the remote service refuses autoconf for the local domain... (tried to peek exactly the transported message but TLS encrypted)

=> No way I can test the Outlook auto-configuration with a local server.

linagora.com auto-configuration

Outlook auto-configuration works smoothly with our production mail:

https://github.com/linagora/james-project/assets/55171818/7a79f72c-6e03-4c68-b055-dc63012ea0f1

The weird thing is: seems we have neither the SRV autodiscover.linagora.com record nor the XML file on our production...

I am not sure how the auto discover service of MS scans our production yet. At least a hint: Outlook autoconf does not work for our preprod domain upn.integration-open-paas.org, maybe something is different between 2 env...

quantranhong1999 commented 1 year ago

I got 1 idea to test the XML file: try to serve upn.integration-open-paas.org/autodiscover/autodiscover.xml and see if Outlook auto-conf for pre-prod works.

quantranhong1999 commented 1 year ago

I understood how it works now.

I and @ducnm0711 set up a DNS record for autodiscover.upn.integration-open-paas.org with a simple empty NGINX server at that address, and Outlook auto-configuration just works smoothly for our preprod:

https://github.com/linagora/james-project/assets/55171818/68fea8cd-83ca-4e4b-af32-d3ad903105da

Tested with Outlook Android as well.

It seems like Outlook auto discovery service would seek a DNS record for autodiscover.domain.tld, then it will automatically search for the IMAP server at imap.domain.tld and the SMTP server at smtp.domain.tld, without any XML auto-configuration file need to be served.

So I think we just need to set up the same DNS record for the customer, and we will be good. Maybe a bit of note in the James example as well.

quantranhong1999 commented 1 year ago

Maybe a bit of note in the James example as well.

https://github.com/apache/james-project/pull/1641