Based on https://github.com/Monogramm/autodiscover-email-settings
Statements | Branches | Functions | Lines |
---|---|---|---|
autoconfig IN AAAA {{$PROXIED_DNS}}
autodiscover IN AAAA {{$PROXIED_DNS}}
imap IN CNAME {{$MX_DOMAIN}}.
smtp IN CNAME {{$MX_DOMAIN}}.
@ IN MX 10 {{$MX_DOMAIN}}.
@ IN TXT "mailconf=https://autoconfig.{{$DOMAIN}}/mail/config-v1.1.xml"
_imaps._tcp IN SRV 0 0 {{IMAP_PORT}} {{MX_DOMAIN}}.
_pop3s._tcp IN SRV 0 0 {{POP_PORT}} {{MX_DOMAIN}}.
_submission._tcp IN SRV 0 0 {{SMTP_PORT}} {{MX_DOMAIN}}.
_autodiscover._tcp IN SRV 0 0 443 autodiscover.{{$DOMAIN}}.
_ldap._tcp IN SRV 0 0 {{LDAP_PORT}} {{LDAP_HOST}}.
Replace above variables with data according to this table
Variable | Description |
---|---|
MX_DOMAIN | The hostname name of your MX server |
DOMAIN | Your apex/bare/naked Domain |
PROXIED_DNS | A placeholder AAAA record pointing to 100:: , which must be proxied through Cloudflare (orange-cloud in the DNS settings). This value specifically is the reserved IPv6 discard prefix but is not the only value allowed. For example, you may also use an A record pointed to 192.0.2.1 or a CNAME pointed to any resolvable target. Whichever method you choose, your record must be proxied through Cloudflare (orange-clouded) and resolve successfully. |
IMAP_PORT | Port for your IMAP server |
POP_PORT | Port for your POP server |
SMTP_PORT | Port for your SMTP server |
LDAP_HOST | The hostname of your LDAP server |
LDAP_PORT | Port for your LDAP server |
- Clone this repo and make sure your have
wrangler
installed Wrangler Docs npm i
(of course)- Rename
wrangler.toml.example
towrangler.toml
and populate with variables. Wrangler Docs - To test, use
wrangler dev
, to build usewrangler build
- Add the settings listed in
settings.ts
to your Cloudflare Worker Environment Variables - Set up DNS records
- Use
wrangler
to deploy your worker
Inspired from https://github.com/sylvaindumont/autodiscover.xml, but without the few restrictions mentioned in the original project notes and with an optional simple support page to allow manual setup and iOS profile download.
The original project was inspired from https://github.com/johansmitsnl/docker-email-autodiscover, but with https://github.com/Tiliq/autodiscover.xml instead of https://github.com/gronke/email-autodiscover to allow a much lighter () image based of node on alpine instead of apache on debian ()
The above autoconfiguration methods assume the following:
- If username does not contain
@
, full email address will be generated based on domain settings
-
Mozilla Autoconfig configuration
-
Microsoft Exchange Command Reference
-
Microsoft Outlook Protocol Examples
-
Bootstrap, jQuery and Popper.js used for default support page
This project is distributed under the MIT License