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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,472
Community Members
 
Community Events
185
Community Groups

Send a custom email (ScriptRunner) BCC Configuration

Hello all,

I am attempting to create a custom email post function using the Send a custom email (ScriptRunner). One of our main requirements for this is that it sends to the blind carbon copy (Bcc). I've referenced two different scripts both with no success either individually or combined. The emails will be fail in the mail queue. 

See Linked

https://community.atlassian.com/t5/Jira-questions/Add-Bcc-to-custom-email-via-post-function/qaq-p/626373

https://docs.adaptavist.com/sr4js/latest/features/workflows/post-functions/built-in-post-functions/send-a-custom-email

Condition and Configuration

import com.atlassian.jira.component.ComponentAccessor

//set recipients from request participants

def multiSelectAddressesCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Request participants")

def recipients = issue.getCustomFieldValue(multiSelectAddressesCF)?.join(",")

 

mail.setBcc(recipients )

I have been able to test this with the "mail.setTo(recipients )" with success. Also inputting the direct email into "mail.setBcc("me@example.com" )" will not send to the Bcc but it will send to the "TO" recipient. 

Any and all help is appreciated. 

Jira Version: 8.20.12

Scriptrunner Version: 7.8.0

 

 

1 answer

1 accepted

0 votes
Answer accepted

I was finally able to get it going with the following script in the condition and configuration. I also needed to clear the cache in order to get it going. 

import com.atlassian.jira.component.ComponentAccessor

//set recipients from request participants

def multiSelectAddressesCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Bcc..")

def recipients = issue.getCustomFieldValue(multiSelectAddressesCF)?.collect {

    it.emailAddress

}?.join(",")

//BCC Email List

mail.setBcc(recipients)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events