It took me a while to realize that the SCRIPT extension is not performed by Groovy itself, but by the emailex function.
So the workaround was to prevent Groovy from expanding the outer layer:
def body = "\${SCRIPT, template='${template}'}"
After that, when I pass the body emailext argument, it will be decrypted correctly.
sorin source share