Configuring autodiscover

While using ActiveSync allows for entering server name explicitly, it's possible to configure autodiscover feature so that email client can get matching ActiveSync server details from a email address.

Please bear in mind that this configuration is performed for primary domain. For example, if you have WebMail Pro (or Aurora Corporate) installed at webmail.domain.com and ActiveServer is available at sync.domain.com, autodiscover needs to be configured for domain.com host, and it's assumed that you're dealing with @domain.com email addresses.

If reconfiguring primary domain is not an option, you can set up autodiscover.domain.com - most clients would check both and use whichever one is available.

Actually, to discover settings for email account in domain.com domain, email clients check against URL of the following kind:

domain.com/Autodiscover/Autodiscover.xml

or:

autodiscover.domain.com/Autodiscover/Autodiscover.xml

So if you wish to have autodiscover enabled, reconfigure your web server by adding an alias pointing from URL of that kind to https://webmail.domain.com?autodiscover - with the correct URL of WebMail Pro or Aurora Corporate specified.

Apache configuration

RewriteEngine on
RewriteRule "^autodiscover/autodiscover.xml$" "/?autodiscover" [NC,L]

Nginx configuration

location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml {
    return 307  https://webmail.domain.com/?autodiscover;
}

Autodiscover setup

It's important to explicitly enable autodiscover in Aurora or WebMail Pro configuration by adjusting data/settings/modules/Autodiscover.config.json file:

  • set "Disabled" to false;
  • "Server" has to be set to ActiveServer hostname, something like "sync.yourdomain.com" - don't put https:// or trailing slashes there.

You can check if autodiscover responds correctly using the following PHP sample:

<?php
$sUrl = "https://domain.com/autodiscover/autodiscover.xml";
$sEmail = "user@domain.com";
$sPost = '<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>'.$sEmail.'</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>';
$rCurl = curl_init();
$acurlOpt = array(
    CURLOPT_URL => $sUrl,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $sPost,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,    
    CURLOPT_HTTPHEADER => array('Content-Type: text/xml')
);
curl_setopt_array($rCurl, $acurlOpt);
$mResult = curl_exec($rCurl);
curl_close($rCurl);
echo "<pre>".htmlspecialchars($mResult)."</pre>";

If you open it in the browser, the valid response would look like:

<?xml version="1.0" encoding="utf-8"?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
    <Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
        <Culture>en:us</Culture>
        <User>
            <DisplayName>test@yourdomain.com</DisplayName>
            <EMailAddress>test@yourdomain.com</EMailAddress>
        </User>
        <Action>
            <Settings>
                <Server>
                    <Type>MobileSync</Type>
                    <Url>https://sync.yourdomain.com/Microsoft-Server-ActiveSync</Url>
                    <Name>https://sync.yourdomain.com/Microsoft-Server-ActiveSync</Name>
                </Server>
            </Settings>
        </Action>
    </Response>