WebMail Pro documentation

Configuring autodiscover for mobile app

When using mobile app with WebMail Pro, normally you would enter just the email address and password - and there has to be a way for a mobile app to determine URL of WebMail Pro installation. That is the purpose of the autodiscover feature.

If you enter email address that looks like username@domain.com, mobile app will take the domain.com part and will check domain.com server to find out WebMail Pro installation location from there.

IMPORTANT: autodiscover needs to be set up for the primary domain. For example, if you have a server that hosts domain.com website but WebMail Pro installation is found on a different server, e.g. afterlogic.domain.com - you still need to perform the configuration on webserver that runs domain.com website.

To determine the product installation URL, mobile app sends request to URL of the following kind:


The simplest solution is to redirect all the requests sent to that server over to the single WebMail Pro installation. To do so, you need to have aurora-autodiscover.json file of the following kind placed at domain.com server, under root web directory:


It means that mobile app will connect to WebMail Pro installation found at https://afterlogic.domain.com address.

If you have several WebMail Pro installations or multiple domains, and you need more complex logic, you'll need to use PHP script instead of static JSON file. You can use the following sample for creating your aurora-autodiscover.php script:

$oResponse = array(
    'url' => '',
    'error' => ''
$aUsers = array(
    "test@domain.com" => "https://test.domain.com"
$aServers = array(
    "domain.com" => "https://afterlogic.domain.com",
    "demo.domain.com" => "https://demo.domain.com"
try {
        $sEmail = (string) $_GET['email'];
        $aEmailData = explode('@', $sEmail);
        $sDomain = "";
        if (isset($aEmailData[1])) {
            $sDomain = $aEmailData[1];
        } else {
            $oResponse['error'] = "Incorrect email";
    if (isset($aUsers[$sEmail])) {
        $oResponse['url'] = $aUsers[$sEmail];
    else if (isset($aServers[$sDomain])) {
        $oResponse['url'] = $aServers[$sDomain];
    } else {
        $oResponse['error'] = "Unknown email";
} catch (Exception $e) {
    $oResponse['error'] = $e->getMessage();
header("Content-Type: application/json");
echo json_encode($oResponse);

And since requests will be looking for aurora-autodiscover.json file you'd need to rewrite URLs so aurora-autodiscover.php script is actually executed. For Nginx web server, you can find sample configuration below:

location ~* ^/aurora-autodiscover.json {
        alias /var/www/html/aurora-autodiscover.php;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS $ssl;