Autoconfig/autodiscover for local mail clients *free script*

Unless you’re having client software that’s more than 14 years old, there’s no issue whatsoever. You’re using HSTS for web as well, no?

Feel free to submit a PR if you wish :slight_smile: If I get a chance I may look into it, but I’ve not used it before so need to read up on how it works. Part of the problem I saw when I looked into it briefly this morning, is that it wants the MX records included. Thats fine if using local DNS, but if like me you use your hosting provider DNS, then it would need to know the MX records. I guess it could be done via a dig request.

Another thing to take into account, would be that it needs to be in “testing” mode to start with, and then you can tweak to live once happy its working.

Thank you for posting this script it helped me to fix a lot of problems I was facing with domain setup and users with Apple Mail and new ms-outlook.

I wrote a new refreshed script based on the 1st post from GitHub that can fix automatically for all domains as long as you add at least 1 email account to it, not only enables you and users to configure their emails with auto-config and auto-discover but it will solve the issue with mts-sts and .htaccess.

The new script autogenerates _mta-sts id and backup and changes the existing .htaccess file to allow access to the newly created files and folders with the right user and domain permissions. the only thing needed is to add “tlsrpt” as an email alias or create a new email to receive the notification from Google or Yahoo as per the latest guidelines by Google and Yahoo Email change starting February 2024 for smtp-tls reporting.

Because I had this already setup I didn’t get any problems until today. Tested for 4 months now and it works, the last domain was done today.

This is why I decided to share in this forum so that all of us can benefit from it.

The script filename is add-autodiscover-complete.cgi.

I have the modified script ready to email (just send me message) or share in a repository or if the forum admin gives me a better way to share it because it is long and does not allow me to post it here.

Looking forward, Thank you



Thanks for your work :slight_smile: Feel free to message it to me on [email protected], and I can add it to the repo once checked :slight_smile:



1 Like

Hi Andrew,

I have sent the file by email now, check it and share if you can via github. thank you :smile:


1 Like

Does this work in an email-only server? Is it easy to adapt in case it isn’t possible?

No it doesn’t it requires the files to be create on:

Fantastic hopefully this will make it in to the next HestiaCP release.

We Always had trouble when setting up Email with Apple iPhone mail and would constantly cause users to get fail2banned because it would put in the wrong IMAP/SMTP Server address and would not use the full email for the username.

Can anyone here confirm this fixes that so all mail users have to do is enter an email and a password and it will just configure itself.

If I configure the web server as an email server too but don’t publish DNS… Will that work?

I am thinking that maybe a checkbox in the advanced config of the web hosting section could just create the files. That way, the auto discover functionality would be independent of the mail server.