Is it possible to allow the use of conditional blocks like ${IF-MAIL} in the DNS Server Template?

Such as the conditional blocks used in Server Templates Mail for domain?

By the help you can

Docs as well

Unfortunately this is not working for me. Anything I enter into the DNS field gets wiped out on save. It’s the reason why I am asking if it is possible to do.

If anyone is able to accomplish this? I would like to know what I am doing wrong.

That sounds like you haven’t selected “Recods below” and left it at “No additional records”. (Or maybe a bug, but I would think we’d have heard a lot of complaints about such a bug.)

I have an entry for cname and that works as expected. If I enter a conditional above or below it, everything from the the start of ${IF-MAIL} to the closing gets wiped out and only the CNAME remains in place.

This would be the code that does not work for me.

${IF-MAIL}
${DOM}.        MX  5 ${HOSTNAME}.
${ENDIF-MAIL}

Please let me know if I am doing this wrong.

Edit: I am doing this because the Hostname field doesn’t seem to be working as well. I have that on another post from a few days ago.

Thank You,

So I had some time this morning to try these entries on my personal server and everything worked as it should. The code I pasted above worked with no issues including the CNAME entry.

I went back to the my clients server after getting permission to reboot it and I guess that did the trick.
The only thing I can think of is they didn’t reboot after an update? IDK, I don’t get paid to do this…

Thank you both for your time, I am going to play around with this on my end because it looks really handy to have knowledge on…

That’s interesting. The only way I can think that’d happen is if there was a bug in a prior version of Virtualmin and an update fixed it. I don’t remember such a bug being fixed, but Jamie and Ilia are more involved in development these days than me, so I miss a lot.

But, always checking with the latest version is a good practice when things are acting weird. We do fix bugs whenever we find them, so most of the time, a newer version is likely to have fewer bugs than older ones.

I relocated this to the Virtualmin category, as it isn’t a feature request (the feature exists already).