MailSuite Pro documentation

Autodiscover configuration

Introduction

Configuring Autodiscover would allow email clients such as Outlook to automatically determine IMAP and SMTP server settings based on mail server hostname.

This configuration requires performing several steps described below.

Configuring DNS records

Assuming you set this up for some mydomain.com, you will need to have autodiscover.mydomain.com CNAME created for your domain. Most domain name registrars allow for adding subdomains and/or managing DNS records. It usually takes a few hours to have DNS changes propagated.

Reconfiguring web server

Email clients which use autodiscover approach would attempt to send requests to an address of the following kind:

http://autodiscover.yourdomain.com/autodiscover/autodiscover.xml

You'll need to reconfigure your webserver (most likely, specific virtual host assigned for MailSuite Pro) to have that URL redirected to:

http://autodiscover.yourdomain.com/index.php?autodiscover

- assuming http://autodiscover.yourdomain.com/ is the URL of your MailSuite Pro installation.

Example of nginx config:

server {
    listen 443 ssl;

    root html;
    server_name autodiscover.yourdomain.com;

    include "nginx.inc.webmail.conf";

    location / {
        location ~* /autodiscover/autodiscover.xml {
            rewrite (?i)^/autodiscover/autodiscover.xml(.*) /index.php?autodiscover last;
        }
    }
}

Verifying configuration

Now that configuration changes were made, you can try checking those with Outlook or another client which supports autodiscover. Another option is to try the following PHP sample code:

<?php
$url = "http://autodiscover.yourdomain.com/autodiscover/autodiscover.xml";
$email = "username@yourdomain.com";
$sInput = '<?'.'xml version="1.0" encoding="utf-8"?'.'><Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>'.$email.'</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>';
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_URL => $url,
  CURLOPT_POST => 1,
  CURLOPT_POSTFIELDS => $sInput
));
$resp = curl_exec($curl);
curl_close($curl);
echo '<pre>'.htmlspecialchars($resp).'</pre>';

On success, you'll get the complete list of data in XML format required for autodiscover to work on email client end - hostnames, port numbers, SSL-related information, etc.