Extension to the recently added MX Templates feature: https://www.directadmin.com/features.php?id=2285 Added support for any DNS record type (tested with A, CNAME, SRV, MX) Changes also allow for on/off switch on the "Local Mailserver" checkbox, automatically, eg: |?EXTRA_SPF=include:spf.protection.outlook.com| |?SPF_STRICT=-all| |?LOCAL_DOMAIN=no| inside the .txt template files. The EXTRA_SPF is inserted to the end of the v=spf TXT/SPF records, before the ~all/-all/?all. The SPF_STRICT allows setting the desired enforcement level. All 3 default mx templates now use: |?SPF_STRICT=-all| ================ CHANGING BETWEEN TEMPLATES When selecting a different template of reverting back to the default, DA will first load in all templates and compare the first MX record to see if it's listed in any of the templates. This lets determine which template is actively being used (exact match) With that being known, DA can scan the current zone for required changes, including removal of all listed records listed in the template. It will also revert to the default SPF back to the default dns_txt.conf / dns_spf.conf, and redo the adding of the next template into it, where applicable. The Local Mailserver option (LOCAL_DOMAIN=no|yes) will use the currently selected templates's LOCAL_DOMAIN setting to decide if any change should be made. Note: if the new template is unset, then it's possible the value won't be altered. But the "default" template will always turn it back on. If you create a new template, it's best to set the LOCAL_DOMAIN variable as needed, so DA doesn't get confused as to what to do. ================ TOKENS DOMAIN_DASH_COM=domain-com which uses a dash instead of the periods, used in office365. ================ TEMPLATES New template file: /usr/local/directadmin/data/templates/mx/office365.txt with contents: |?NAME=Office 365| |?EXTRA_SPF=include:spf.protection.outlook.com| |?SPF_STRICT=-all| |?LOCAL_DOMAIN=no| |DOMAIN|. 3600 IN MX 0 |DOMAIN_DASH_COM|.mail.protection.outlook.com. autodiscover 3600 IN CNAME autodiscover.outlook.com. lyncdiscover 3600 IN CNAME webdir.online.lync.com. msoid 3600 IN CNAME clientconfig.microsoftonline-p.net. sip 3600 CNAME sipdir.online.lync.com. _sip._tls 3600 IN SRV 1 100 443 sipdir.online.lync.com. _sipfederationtls._tcp 3600 SRV 1 100 5061 sipfed.online.lync.com.