Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

send custom email (like jira email format ) using listener

hello can anyone please give me solution to this ,

i have below information which send in mail using listener but ,


i want to send mail in below format,




1 answer

1 accepted

Hi @Sneha Gole,

For your requirement, if you are using the Send custom email listener, you will need to send the email using the HTML format.

To do so in the listener,  you will need to set the Email format to HTML and format the Email template using the HTML parameters as shown in the image below:-



If possible, could you please share your listener configuration?

Thank you and Kind Regards,


Hii @Ram Kumar Aravindakshan _Adaptavist_  thank you for your response .

i am using below listener 



and sending mail using ,

MailServerManager mailServerManager = ComponentAccessor.getMailServerManager()
SMTPMailServer mailServer = mailServerManager.getDefaultSMTPMailServer()

Email email = new Email(issue.getReporter().getEmailAddress())

def toCC = ""
toCC = it.toString() + "," + toCC
log.warn toCC

// email.setCc(toCC)

// email.setSubject(issue.summary)

// email.setBody(html)
// mailServer.send(email)

Hi @Sneha Gole

If you are using the Custom Listener, you can try something like this:-

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.mail.Email

def issue = event.issue
def mailServerManager = ComponentAccessor.mailServerManager
def mailServer = mailServerManager.defaultSMTPMailServer
def reporter = issue.reporter
def emailAddress = reporter.emailAddress
def subject = "This is a test mail"
body = """
<h3>Sample Content For Testing Purposes</h3>

def email = new Email(emailAddress.toString())
def threadClassLoader = Thread.currentThread().contextClassLoader
Thread.currentThread().contextClassLoader = mailServer.class.classLoader
Thread.currentThread().contextClassLoader = threadClassLoader

Please note, this sample code is not 100% exact to your environment. Hence, you will need to make the required modifications.

Basically, the text that you want to format should be added to the HTML body, i.e. 

body = """
<h3>Sample Content For Testing Purposes</h3>

You will need to trim the text if you want to remove the ending portion of the text. You can use the replace option in the String.

I hope this helps to solve your question. :) 

Thank you and Kind Regards,


Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you