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

How to configure sending email for all events related to issues to a non Jira user email in Jira DC

Satchidanand_CS_ext
Contributor
June 27, 2023

Hi,

there is a requirement to send an email for issue created updated and all the events related to it to multiple non jira user group emails for a particular project. can someone try to help as quickly as possible. Our instance is Jira Data center. I found few pages to see if we can use listener but as I'm not familiar with the script could not apply it.

 

Regards,

CS Satchidanand

1 answer

1 accepted

1 vote
Answer accepted
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

Hi, @Satchidanand_CS_ext 

Of course, you can use script with listener, but if you don't have experience in scripting, maybe it's better to use Jira Automation?

Jira DC has Automation by default.

image.png

Satchidanand_CS_ext
Contributor
June 27, 2023

Hi @Evgenii  appreciate your help I have tried this automation before as well it says successfully sent email but there is nothing received in the mail box

automation.PNG

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

Well, if you want, I can give you script for sending emails, but Automation is a good tool too and it's worth to fix it.

I'd check email queues in Jira, to see, if letter appear there, when rule triggers, and of course it's a good idea to check spam folder in mailbox.  I often use this functionality, to send letters to gmail mailbox and letters deliver successfully.

Satchidanand_CS_ext
Contributor
June 27, 2023

email queues im seeing it empty none in email queue or error queue. any setting im missing to check for configuring

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

The easiest from UI is:
Open email queue in one window, and in another window - run action, to trigger sending email. After that refresh window  with email queue. There must appear new email, which is waiting to be send.

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

As I promised, example code to send emails. It can be run from console or listener:

/*
* Created 2023.
* @author Evgeniy Isaenkov
* @github https://github.com/Udjin79/SRUtils
*/

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

String emailAddr = "your_mailbox@gmail.com"
String subject = "TEST letter"
String body = "TEST email body"

Email email = new Email(emailAddr)
email.setSubject(subject)
email.setBody(body)
email.setMimeType('text/html; charset=utf-8')
SingleMailQueueItem smqi = new SingleMailQueueItem(email)
ComponentAccessor.getMailQueue().addItem(smqi)
Satchidanand_CS_ext
Contributor
June 27, 2023

I see this happening but still no email incoming to the mail box

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

If your company use your own mail server, ask your mail administrator to check mail logs, to see, what happens with sent emails. 

Satchidanand_CS_ext
Contributor
June 27, 2023

I am all set but what should I mention in order to get the details for example

Subject: Issue Key was Just created or updated

Content:

If it should be mentioned event-wise

summary of the ticket/comments updated/issue fields. how to place smart values so that it can take it from the ticket

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

Clarify please, you're talking about automation rule or script?

Satchidanand_CS_ext
Contributor
June 27, 2023

For the Automation rule

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2023

Ok, understood. You can use next Smart Values for getting summary or changes, for example:

{{issue.description}} - issue description{{issue.summary}} - issue summary
{{issue.key}} - issue key
// Summary changes
{{#changelog.summary}} {{toString}} {{/}}
// Previous status name
{{#changelog.status}}{{fromString}}{{/}}

If you want to show event type, you can use:

{{eventType}}

Also, event type Smart Value can be used for managing rule conditions.

More information can be found here:

https://confluence.atlassian.com/automation/smart-values-in-jira-automation-993924627.html

Like Satchidanand_CS_ext likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events