How do I format e-mail body in Send a custom email post-function?

Szymon Trocha July 19, 2019

Hi,

I'm having troubles in formatting the body of my e-mail I'm trying to send using Scriptrunner "Send custom e-mail" via post-function. I'm trying to get at least new lines but none of the ways work. This is my script in email template:

Dear Sirs,

First <% print "\n" %>
Second <% print "\\n" %>
Third <% out <<"\n" %>
Fourth <% out <<"\\n" %>
Fifth \n
Sixth \\n
This is the body, and should be a new line before and after

Regards,

<% out << issue.reporter?.displayName %>

But instead of any formatted email I get a single line:

"Dear Sirs, First Second Third Fourth \n Fifth Sixth \n This is the body, and should be a new line before and after Regards, John Smith"

Any help?

Thank you in advance

1 answer

1 accepted

0 votes
Answer accepted
Thanos Batagiannis [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2019

Hi Szymon

You can select an HTML template and then for every new line you could use <br>.

Also (unless you are in a very old version of the plugin) you could use the condition field and the config map to push the reporter name and then use it in the email template. 

So in your case you could have something like 

Screenshot 2019-07-19 at 15.42.38.png

Szymon Trocha July 22, 2019

Thanos,

Works perfect! Thank you.

How could I miss such obvious way :-(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events