Autoconfig/autodiscover for local mail clients *free script*

Hi,

I have wanted to have autoconfig for email accounts for a while. I’m fed up with people asking me “what port number?” etc :wink: So I wrote a little script for Hestia that helps setup the autoconfig/autodiscover functions:

Its designed for Linode servers, but the logic can be used on any (you will just need to tweak the bits with linode-cli).

Hopefully this is of use to someone - and forks/shares are much appreciated if you have any suggestions.

Cheers

Andy

2 Likes

Hi @andrewnewby This is fantastic I have been looking for something like this for awhile.
Open a PR for Hestia so it may get implemented.

We need to modify it any way as it only works for linode…

I just noticed that too @eris
@andrewnewby are you able to rewrite it for the Hestia DNS instead of Linode

Probaly the best idea would still be to implement z-push (https://z-push.org/) which has an auto discover feature aswell.

Hi,

The linode-cli part wouldn’t be hard to change if you are using the local DNS on your server. All it needs to do is add 2 new CNAMEs pointing back to the main domain:

autoconfig
autodiscover

Cheers

Andy

2 Likes

I’ve added a new /autodiscover/ios.php script as well, which will be accessable from:

http://www.domain.com/autodiscover/ios.php

What it does is create a .mobileconfig file, which when downloaded on an iOS device will create a profile with the email settings. All they have to do when installing it, is enter the profile password. When I was setting up iPhone test accounts it was soooo painful entering paths (you had to keep repeating stuff, couldn’t copy and paste, etc) … so hopefully this will save some iOS users some grief!

2 Likes

I’m just tweaking the script so people using the local DNS server can make use of it as well. Would this be the correct format to add autoconfig/autodiscover CNAMEs for the domain?

v-add-dns-record $username $domain autodiscover CNAME $domain`;
v-add-dns-record $username $domain autoconfig CNAME $domain`;

Thanks! (I don’t use the local DNS server, so can’t verify thats the correct format :))

Ideally we should convert it a bash script and implement it webmail domain…

So that it also work if you have a mail server only setup.

2 Likes

format should work fine

2 Likes

Feel free if you have the time :slight_smile: Unfortunatly Bash is not one of the languages I’m proficient in (I can play with it, but not write from scratch). Perl is my go-to as its the main language I program in.

format should work fine

Thanks. I’ve updated the script so the admin can tweak which DNS setting it uses:

my $dns_type = "linode";

1 Like

Fantastic!! this keeps getting better!! Especially the IOS mail thats been a pain.
As @eris said we should work on converting it to a bash script as this is default with HestiaCP.
I think the logic is done at this point.
Anyone want here want to take a stab at converting to a bash script and submitting a PR? I really wish I was better at bash.

We are currently looking into implementing ZPush.

2 Likes

zpush sounds good but may be much more complicated to implement and it looks like the last update for zpush was back in the Feb beginning of 2021 which is almost 2 years and doesn’t support php8.0+.
This autodiscover/autoconfig may be a nice quick temp solution

2 Likes

I’ve done some more tweaks. It now creates a file in /installer/discover-configs-done for the domain once its been setup (so we can quickly skip). I’ve also created an add-autodiscover-all.cgi script, which is aimed at setting up the autodiscover on ALL the domains that have mail setup. The idea of this script is that it can also be setup to run on a cronjob (as root), and then when new domains are added it will simply set it up automatically (I’ve set mine to every 6 hours, but you can do what you want)

There is a bit more in the README regarding this

Hopefully someone can convert this into a bash script for others :slight_smile: (its working great for me and all my servers)

1 Like

It looks like Z-push is EOL anyway.

Yeah I noticed that too. Seemed like a great project.

Oh that’s great thank you. The changes keep getting better

While we’re at it, why not also add an mta-sts subdomain, plus add TXT records for _mta-sts and _smtp._tls as well?

Hmm reading up on it, I think the mta-sts stuff could be tricky to add, as its got quite a lot of variables (that could differ for each person)

1 Like