Bulk insert 'autoconfig' and 'autodiscover' DNS records

Ubuntu 20.04

We migrated 150 domains from 4 inconsistently setup Virtualmin servers. What I mean inconsistent:

  • On some servers no SSL enabled per website, only some
  • On other servers no disk space monitoring because quotas were never setup properly from the start
  • Sometimes DMARC/DKIM enabled and sometimes not
  • 3rd Party DNS setup so no DNS integration

What’s most concerning, and what’s overrunning the help desk with support calls, is the lack of autoconfig and autodiscover DNS records. Hours of time working with all the different mail clients and their inconsistent behaviors.

I need a way to insert autoconfig and autodiscover DNS records on around 150 domains on a server.

Please help me.


This can be done with the virtualmin CLI command.

virtualmin modify-dns --all-domains --add-record “autodiscover A”

Replace with the IP you want it pointed to.
Rerun again with autoconfig.
Run the same with AAAA if you also want/need IPv6.

Should do the trick, but you might want to try with one domain first to be sure.
Run ‘virtualmin modify-dns --help’ to see the available options.

1 Like


If you’re like me and you have setup a global set of autoconfig / autodiscover rules…

What I did was simply setup something like, autoconfig.master.com and autodiscover.master.com then I setup an alias autoconfig.customer.com and autodiscover.customer.com each which pointed to the “master” domains.

This means whenever I update the master config it also updates the “customer” config as it’s an alias.

Best Regards,
Peter Knowles | TPN Solutions

1 Like

Hi Peter @tpnsolutions ,

Thank so much for that.

you have setup a global set of autoconfig / autodiscover rules

I’m not sure what you mean by that. I thought that autoconfig and autodiscover were per domain DNS records which simply allows destination email clients like Thunderbird and Outlook to query and find automatic email configuration data. That everything happens behind the scenes and that all is required are those records.

Are you implying that in order to make autoconfig and autodiscover DNS record work additional configuration is needed?

I can confirm that additional configuration is not needed: Virtualmin takes care of this on its own, out of the box, and that is how most of us leave it.

@tpnsolutions outlined a little hack which has the advantage of simplifying updates. This hack is entirely optional.

@tpnsolutions outlined a little hack which has the advantage of simplifying updates. This hack is entirely optional.

I don’t get this part. Does this mean that all clients will have “mail.main-server-domain.com” instead of “mail.their-own-domain.com”?

As of a few days ago when I use autoconfigure all the settings are picked up properly but Thunderbird is now defaulting to the wrong SMTP SSL and so can’t send mail without accepting a certificate warning.

I don’t understand what’s going on because when I do a Let’s Encrypt check the sites look correct.


Yes, which addresses your SSL issue noted as well.

Best Regards,
Peter Knowles | TPN Solutions

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.