Jira notification email has ATT00001.htm attachment

I’m using Script Runner Listener to send notification emails. In my listener, I have code to construct a HTML body for email template, and I have selected HTML as email format. Include attachment is set to “New”, but no attachment is involved in the test cases.

Occasionally, the recipient will receive two emails. One is a normal email with the HTML body, then an additional one with the HTML body plus the HTML body as ATT00001.htm attachment.

Looking for clues I found this:
It is said that the cause is because the email body got text and HTML intermingling. But my email body is HTML entirely.

How do I ensure the email template content will not trigger this problem?