A single Go binary that replaces an nginx + PHP stack for serving email autodiscover responses. It reads a settings.json file and generates XML responses on the fly for multiple protocols and clients.
Supported Protocols and Clients
Protocol / Client Endpoint Format
Microsoft Outlook (POX Autodiscover) POST /autodiscover/autodiscover.xmlPOX XML
Microsoft Exchange ActiveSync POST /autodiscover/autodiscover.xmlMobileSync XML
Thunderbird / Mozilla GET /mail/config-v1.1.xmlclientConfig XML
Apple iOS / macOS GET /profile.mobileconfigProperty List (.plist)
CalDAV (RFC 6764) GET /.well-known/caldavHTTP redirect
CardDAV (RFC 6764) GET /.well-known/carddavHTTP redirect
Matrix federation delegation GET /.well-known/matrix/serverJSON (spec )
Matrix homeserver discovery GET /.well-known/matrix/clientJSON (spec )
You’ll need Go 1.23 or later.
To build for the current machine just do make build. To build for other architectures do something like make build-linux.
./build/autodiscover-linux-amd64 -addr :8080 -config /path/to/settings.json
Flag Default Description
-addr:8080TCP address to listen on
-configsettings.jsonPath to the JSON configuration file
Configuration (settings.json)
See example-settings.json for a complete example.
Field Type Required Description
infoobject yes General provider information
serverobject yes IMAP and SMTP server settings
ttlinteger no Time-to-live in hours for cached settings. Defaults to 1
matrixobject no Matrix well-known delegation targets
caldavobject no CalDAV server configuration
carddavobject no CardDAV server configuration
exchangeobject no Microsoft Exchange Web Services URLs
activesyncobject no Exchange ActiveSync endpoint URL
vpnobject no VPN configuration for Apple profiles
mdmobject no Mobile Device Management enrollment URL
Field Type Description
namestring Human-readable provider name
urlstring Support or home page URL
domainstring Primary mail domain
server.imap and server.smtp
Field Type Description
hoststring Server hostname or IP address
portinteger TCP port number
socketstring Encryption method: "SSL", "STARTTLS", or "plain"
Field Type Description
domain_requiredboolean Whether the authentication domain is required
Field Type Description
hoststring DAV server hostname
portinteger TCP port number
sslboolean Whether to use HTTPS
principal_urlstring User-specific principal path. Supports placeholders %EMAILADDRESS%, %EMAILLOCALPART%, %EMAILDOMAIN%
Optional. When absent, both matrix endpoints return 404 with a plain-text
explanation (which triggers SRV-based federation fallback).
Field Type Description
serverstring Value for m.server — the target homeserver hostname (or host:port) federation uses
homeserverstring Value for m.homeserver.base_url, e.g. https://matrix.example.com
identity_serverstring Optional override for m.identity_server.base_url, defaults to homeserver
Field Type Description
ews_urlstring Exchange Web Services URL
oab_urlstring Offline Address Book URL
oof_urlstring Out of Office URL
Field Type Description
urlstring ActiveSync endpoint (e.g. https://mail.example.com/Microsoft-Server-ActiveSync)
Field Type Description
typestring VPN type: "IKEv2", "L2TP", "PPTP", "IPSec", etc.
hoststring VPN server hostname
remote_idstring Remote identifier (e.g. for IKEv2)
local_idstring Local identifier (e.g. for IKEv2)
auth_methodstring Authentication method: "None", "Certificate", "SharedSecret", "Password"
Field Type Description
server_urlstring MDM enrollment server URL
The following placeholders are expanded in URLs where noted above:
Placeholder Expands to
%EMAILADDRESS%Full email address, e.g. user@example.com
%EMAILLOCALPART%Local part, e.g. user
%EMAILDOMAIN%Domain part, e.g. example.com
Apple Configuration Profile (/profile.mobileconfig)
When ?email=user@example.com is provided, the generated .mobileconfig includes payloads for all configured services:
Email (com.apple.mail.managed) — IMAP incoming, SMTP outgoing
CalDAV (com.apple.caldav.account)
CardDAV (com.apple.carddav.account)
VPN (com.apple.vpn.managed)
MDM (com.apple.mdm)
Payload UUIDs are deterministically derived from the domain and payload type so they remain stable across restarts.
The server responds to RFC 6764 .well-known requests with HTTP redirects to the configured DAV principal URLs:
Request Redirect
GET /.well-known/caldav?email=user@example.com307 = to expanded CalDAV principal URL
GET /.well-known/carddav?email=user@example.com307 = to expanded CalDAV principal URL
GET /.well-known/matrix/server200 = JSON with m.server
GET /.well-known/matrix/client200 = JSON with homeserver/identity URLs