How to send email use JIRA notification service with ScriptRunner groovy script?


I am currently able to send email using SMTPMailServer.send, however this method appears to be blocking and returning only when the email has been sent.

What I would like is for the function just to put the email in the JIRA email queue and then return immediately which appear to be the behaviour for standard JIRA notification such as "Send notification on new comment for watched issues".

Is there a way to use the JIRA standard notification engine when sending custom email via groovy SR script?



3 answers

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

def email = new Email("jamie@")
def item = new SingleMailQueueItem(email)

do you know, how can I do in CLoud, the same?Thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

455 views 8 27
Read article

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