I had autoconfig setup for business emails before cloudron. Here is the process I used:
Let's say you have the following domains:
test.com: The domain for which you want to have email autoconfig
my.test.com: The URL of your cloudron server that manages your email and will broadcast the autoconfig configuration.
setup DNS entries in the test.com DNS
// entry for outlook (never tested since I only use thunderbird)
_autodiscover._tcp 600 IN SRV 0 0 443 my.test.com
// entry for thunderbird and others
autoconfig 600 IN CNAME my.test.com
smtp 600 IN CNAME my.test.com
imap 600 IN CNAME my.test.com
// autoconfig.test.com does not need an SSL certificate
// smtp.test.com, imap.test.com must have an active SSL certificate
Create the mail directory and autoconfig file
in the webroot for autoconfig.test.com create the file
mail/config-v1.1.xml
Content of mail/config-v1.1.xml
// Here is a sample:
<?xml version="1.0" encoding="UTF-8"?>
<clientConfig version="1.1">
<emailProvider id="my.test.com">
<domain>test.com</domain>
<domain>another-domain.com</domain>
<displayName>test.com</displayName>
<displayShortName>Test</displayShortName>
<incomingServer type="imap">
<hostname>imap.test.com</hostname>
<port>993</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<outgoingServer type="smtp">
<hostname>smtp.test.com</hostname>
<port>587</port>
<socketType>STARTTLS</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</outgoingServer>
</emailProvider>
</clientConfig>
Nginx config
since autoconfig does not require any SSL certificate you can setup any autoconfig request to match the same config file. For cloudron it might be better to have one config file per domain?
server {
listen 80;
server_name
autoconfig.*;
root /var/www/autoconfig.test.com;
access_log /var/log/nginx/autoconfig.test.com/access.log;
error_log /var/log/nginx/autoconfig.test.com/error.log warn;
location / {
try_files $uri $uri/;
}
}
Aside note
in theory you should be able to not use imap.test.com and smtp.test.com, in practice though, I had trouble with thunderbird not recognizing the autoconfig without those 2 domains setup (it was 1 year ago, maybe it changed since)
Hope it helps! I'll be happy to assist implementing if interested