//remove the enter which was created by system
messageBody = strReplace(messageBody, '\n', '');
messageBody = SysEmailMessage::stringExpand(messageBody, SysEmailTable::htmlEncodeParameters(_mappings));
messageBody = strReplace(messageBody, '\n', '<br>');
Based on the testing, I noticed that, standard AX sytem will add the <br> infront each line after call strReplace
<BODY><P><FONT size=2 face=Calibri>Hi All,</FONT></P></BODY>
After call the StrReplace function :
<br><BODY><P><FONT size=2 face=Calibri>Hi All,</FONT></P></BODY>
So i try to remove the default enter before expand the mapping value.