Send custom email with rich text formatting

Hello smile

I have kind of an issue when sending a using send custom email with scriptrunner. 

See the following code:

<% 
def userKey = "customer.care"
def commentManager = com.atlassian.jira.component.ComponentAccessor.getCommentManager()
def comments = commentManager.getComments(issue)
def lastCommentFromUser = comments?.findAll {it.authorApplicationUser.key == userKey}
def issueDesc = issue.description
def emailAdr = issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObject(10301))
def emailSubj = issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObject(10805))
def emailBody = issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObject(11374)) 
def emailInfo = "<br/><br/>From: " << emailAdr << "<br/>" << "Sent: " << "$lastCommentFromUser.created" << "<br/>" << "To: " << "ACNVFEscalations@acnpacific.com.au" << "<br/>" << "Subject: " << emailSubj << "<br/><br/>"
                                          
if (lastCommentFromUser) 
	lastCommentFromUser = out << emailBody.replaceAll("\\n","<br/>") << "\n\n" << emailInfo << "\n\n" << lastCommentFromUser.last().body.replaceAll("\n","<br>")  
	else if (issueDesc)
        lastCommentFromUser = out << emailBody.replaceAll("\\n","<br/>") << "\n\n" << "------Original Message------" << "\n\n" << issueDesc.replaceAll("\\n","<br/>")
		else lastCommentFromUser = out << emailBody.replaceAll("\\n","<br/>")
%>

When sending email with HTML text setting (or plain text), the comments with bold are rendered as *text* instead of the text actually being bold. 

 

Are there any solutions to this, i was also thinking of adding rich text to the email body field to send emails with.

 

I greatly appreciate your assistance. 

regards, 

Pon

1 answer

using JIRA 6.3.3

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

212 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you