Mailinabox: Outlook autodiscover / autoconfig subdomain DNS entries

Created on 3 Jul 2017  路  8Comments  路  Source: mail-in-a-box/mailinabox

Why doesn't Mail-in-a-Box auto-create the DNS entries for autodiscover.* and autoconfig.* for auto-email client setup out of the box?

Even when I add these in as Custom DNS entries, Mail-in-a-Box doesn't allow me to generate the required Lets Encrypt certificate for auto setup to work correctly, so to get this to work I need to create a random account at both the autoconfig.* and autodiscover.* subdomains for each domain name I host on the server!

Is there a reason this isn't already working out of the box?

Most helpful comment

Great work @hachre

I wonder if this can be implemented into an update?

All 8 comments

There's no particular reason other than that it's yet another feature that someone would have to implement. I think there are usually multiple autodiscover methods available (other than creating subdomains) that might be easier for us to implement. Maybe we already have it (I forget).

It doesn't work 'out of the box' today unfortunately, unless I've been missing something crucial during setup.

As far as I remember when I reviewed it about 3 months ago, Mail-in-a-box used the auto configuration for Thunderbird as well as the z-push one for ActiveSync. Nothing for Exchange / Outlook.

First thing to do would be to look for Microsoft's specification for how Outlook autodiscovery works and then compare against what we have (and here).

I looked into this. It affects both Outlook as well as the Windows 10 apps like Mail, People and Calendar. None of them can set up the account automatically (and doing it manually is a major hassle on the new versions).

There's two things missing to make it work:

  1. For each domain, that is used for mail aliases, the autodiscover.example.com subdomain has to be present and point to the same Nginx realm that also has the /autodiscover path in it. We already have this set up in the Nginx local.conf, however without using the autodiscover subdomain. The required autodiscovery XML information is then automatically provided by z-push.

  2. Something in creating the z-push configuration must be wrong, because the XML file that is being sent to clients seems to contain the hostname set to the string PRIMARY_HOSTNAME instead of whatever real hostname was set up in mail-in-a-box.

Tested and it's working for Windows 10 apps after these changes:

I created the autodiscover subdomain by adding a dummy mail alias via the admin interface. This fixed clients not finding the autodiscovery information at all.

I then additionally went to /usr/local/lib/z-push/autodiscover/config.php and edited the line define('ZPUSH_HOST', 'PRIMARY_HOSTNAME'); to have the correct hostname.

This made everything work for me in the Windows 10 apps!

Outlook still doesn't work out of the box (manual workaround required)

It does work in older versions but not in the very latest one which just came out a few days ago. I haven't been able to figure out why. I suspect this is a compatibility issue between the newest Outlook version and z-push.

When Outlook tries to do autodiscovery, the z-push autodiscover-error.log fills up with the following errors. Z-push hides the autodiscovery XML behind a HTTP AUTH login, which Outlook apparently fails to provide.

25/07/2017 08:31:29 [30982] [FATAL] [unknown] Exception: (AuthenticationRequiredException) - Unauthorized
25/07/2017 08:31:29 [30982] [ERROR] [unknown] Unable to complete autodiscover incorrect request: 'Unauthorized'
Manual workaround:

In order to get the latest Outlook Office 365 version to work, you have to close Outlook, go to the old Windows Control Panel, search for Mail there and set it up through the old manual interface there. The main Outlook frontend now always uses autodiscovery and doesn't allow you to set up manually.

Great work @hachre

I wonder if this can be implemented into an update?

Can you link to a Microsoft document with the specification?

Hello Josh et al,
This is something I implemented, so hopefully I can help.
A pretty complete example from Microsoft: https://github.com/progmaticltd/homebox/blob/master/install/playbooks/roles/autoconfig/doc/autodiscover.xml
My solution for both autoconfig and autodiscover is here:
https://github.com/progmaticltd/homebox/tree/master/install/playbooks/roles/autoconfig
The tricky thing was to serve static content with POST, which is an error, IMHO.
The page need to be https
Good luck.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ad-si picture ad-si  路  6Comments

fmonts picture fmonts  路  6Comments

jalogisch picture jalogisch  路  5Comments

glaszig picture glaszig  路  8Comments

webknjaz picture webknjaz  路  8Comments