Personally, I don't heat my Mash Tun but for the Strike Water and Sparge Water Heater there was a little cap that came with the element.
If you send a link, so that we can take a look at the particular element that you have purchased, then a suitable (and safe) solution may spring to mind. :thumb: