Skip to content

Latest commit

 

History

History
129 lines (104 loc) · 5.42 KB

README.md

File metadata and controls

129 lines (104 loc) · 5.42 KB

php-autodiscover

Simple Autdiscover/Autoconfig XML generator written in PHP.

Autodiscover was developed by Microsoft to simply set an email client according to Active Directory.

It tried to do it as simple as possible.

Tested with:

  • Android E-mail app
  • Thunderbird
  • Mail (Windows 10 native client)
  • Microsoft Outlook 2010
  • Evolution (Gnome native client)

Alternative way how to autoconfigure mail clients is

  • SRV DNS records according to RFC6186

Prerequisites

You should have:

  • correctly set mail server (great instructions written by Sam Hobbs for Raspberry Pi).
  • correctly configured DNS records for subdomains autodiscover.<domain> and autoconfig.<domain>
  • valid TLS certificates for your subdomains autodiscover.<domain> and autoconfig.<domain> (eg. Let's Encrypt).
  • installed composer, project depends on some other PHP libraries

DNS records

There are differencies how clients calls for autoconfiguration:

  • autodiscover.<domain>, eg. autodiscover.example.com (used by Exchange-like accounts)
  • autoconfig.<domain>, eg. autoconfig.example.com (used by Thunderbird)

Usage

Clone project to your web root

cd /var/www
git clone https://github.com/hmlkao/php-autodiscover.git autodiscover
cd autodiscover
composer install

Web server configuration examples

Nginx

Apache

Multiple domains on one machine

Copy autodiscover.php file to your web root for each of your domains, eg. /var/www/autodiscover/example-1.php

NOTE: If is your configuration same for all domains it requires only different Web server settings

Email clients

Microsoft Office Outlook 2010 (v14.0.7212.5000)

The process how is Outlook looking for settings is well described here

  1. Open File > Add account
  2. Enter your mail
  3. Version 2010 tries only URL GET https://autodiscover.<domain>/autodiscover/autodiscover.xml
    <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006">
      <Request>
        <EMailAddress>%email%</EMailAddress>
        <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006</AcceptableResponseSchema>
      </Request>
    </Autodiscover>

Microsoft Mail (v16005.10730.20115.0)

Native application available for Mail, Calendar and Contatcts in Microsoft Windows 10.

  1. Add account > Other (POP, IMAP)
  2. Enter your mail address and password

Mozilla Thunderbird (v60.0)

  1. Open Menu > Preferences > Account Settings
  2. In the left bottom corner open Account Actions > Add Mail Account...
  3. Enter 'Email address' and 'Password' and click on Continue
  4. Thunderbird tries open URL GET https://autoconfig.<domain>/mail/config-v1.1.xml?emailaddress=%email% where %email% is requested email address, eg. jon.doe@example.com

Evolution (v3.28.5)

You HAVE TO add account directly in Gnome settings, not it Evolution (it doesn't work from some reason)

  1. Settings > Online Accounts > click on More at the bottom > IMAP and SMTP
  2. Enter your mail address and password
  3. You will see IMAP settings at first
  4. Then SMTP settings
  5. Evolution tries open URLs POST https://<domain>/autodiscover/autodiscover.xml and POST https://autodiscover.<domain>/autodiscover/autodiscover.xml with data:
    <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>
    where %email% is requested email address, eg. jon.doe@example.com
  6. After all you find your mailbox in Evolution

Android E-mail (v6.41.18)

NOT SUPPORTED - it sends mobilesync request

  1. Go to Settings > Add account > Microsoft Exchange
  2. Application tries open URL POST https://autodiscover.<domain>/autodiscover/autodiscover.xml with data:
    <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006">
      <Request>
        <EMailAddress>%email%</EMailAddress>
        <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006</AcceptableResponseSchema>
      </Request>
    </Autodiscover>
    where %email% is requested email address, eg. jon.doe@example.com

Other

You should choose Exchange as a source for email.

TODO

  • Nginx examples
  • Apache examples
  • Factory to create response