I format mail body with script, event calls mail action and mail action is calling script with %[scriptname] in message text.
if you want event param 2 use $event->parameters[2] in script
Create a string variable with all the text you want then just return it and it will use that for the mail text, for line break use \n
If you are scripting you have access to these to get the data you want also:
https://wiki.netxms.org/wiki/NXSL_Function_Reference