# Automatic email configuration for Outlook, Thunderbird, IOS.

# Using autodiscover.xml and config-v1.1.xml and ios.mobileconfig

Some email clients have methods to auto detect server settings to make it easier for users to setup their email. Since version 7.2j-13 Surgemail automatically responds to these requests, but to make it work you must have the correct ports open and DNS entries.
Given your mail server is called MAIL.MYDOMAIN.COM, then to make it work you will need to add these DNS entries:
autoconfig.MYDOMAIN.COM --> mail.mydomain.com (used by thunderbird)
For Outlook its more tricky, the problem is the name must have a signed ssl certificate, so if you have a wild card certificate, then you can just add a DNS entry like this:
autodiscover.MYDOMAIN.COM --> mail.mydomain.com (used by outlook)
But if you just have a certificate for mail.MYDOMAIN.COM, then you need to use an SVR record instead:
_autodiscover._tcp SRV 0 0 443 mail.MYDOMAIN.COM.

> > Service = _autodiscover._tcp
> > Protocol = tcp
> > Name = (leave blank)
> > Priority = 10
> > Weight = 0
> > Port = 443
> > Target = mail.MYDOMAIN.COM.

And you will need to have surgemail listening on port 80 and 443 (so you cannot have a separate web server on the same host/ip address)
g_webmail_port "80,7080"
g_webmail_secure_port "443,7443"
Also ensure your
url_host "mail.mydomain.com"
setting is correct for each domain!
To test to see if the server responds correctly use the following url's. If you are using the SVR record then the second entry for Outlook must work without SSL warnings in your browser, else the first option must work (again without ssl warnings)

URL | Email Client
http://autoconfig.MYDOMAIN.COM/mail/config-v1.1.xml | Thunderbird
https://autodiscover.MYDOMAIN.COM/autodiscover/autodiscover.xml https://mail.MYDOMAIN.COM/autodiscover/autodiscover.xml | Outlook
http://mail.MYDOMAIN.COM/ios | IOS/Iphone/Ipad.

From the email clients themselves you should just need to enter your email address, user@MYDOMAIN.COM and password.
For IOS(Iphones) the user must open the url in safari and enter their email address and name, it then creates the download profile to configure email. The profile is not signed but the user can still use it.
Ensure you have the following ports open through your firewall (at least)

> 110 POP3 services (Also used for mirroring)
> 143 IMAP services
> 25 SMTP services
> 587 SMTP Local Users
> 443 HTTPS secure webmail
> 80 HTTP webmail
> 995 Secure POP3 services
> 993 Secure IMAP services
> 465 Secure SMTP services

Additional DNS entries you may wish to add to help other email clients discover your server correctly:
smtp.MYDOMAIN.COM --> mail.MYDOMAIN.COM
imap.MYDOMAIN.COM --> mail.MYDOMAIN.COM
pop3.MYDOMAIN.COM --> mail.MYDOMAIN.COM