Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Automation: how to use "send email" when a smart value has more than one email?

Pedro Paulo de Freitas Junior
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 12, 2025

I have the following expression to capture a list of emails based on the last comment:

{{#issue.comments.last.body.match("([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})")}}{{.}}, {{/}}

Example:

Comment: email: xpto@xpto.com --> Result: xpto@xpto.com

Comment: email: xpto@xpto.com and abc@abc.com --> Result: xpto@xpto.com, abc@abc.com, 

Comment: email: xpto@xpto.com, abc@abc.com and xyz@xyz.com --> Result: xpto@xpto.com, abc@abc.com, xyz@xyz.com,

I am putting the result inside a variable called "emailList".

This smart value is being added as the "To" in the send email action.

In all cases, the action status is "SUCCESS", but when there are two emails, no one receives the email. Only when there is 1 email or 3 (or more) does it work.

 

2 answers

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2025

Hi @Pedro Paulo de Freitas Junior 

Without seeing your entire rule and audit log details for context...

Please try these two changes:

  • The match() function can have trouble with line breaks and other formatting in comments.  I recommend replacing those and removing duplicates with distinct (to remove any markup problems).
{{issue.comments.last.body.replace("\n", "").match("([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})").distinct.join(", ")}}
  • After your parsing you are storing the result in a Created Variable, and that is plain text.  It must be split back into a list for use in the Send Email action:
{{emailList.split(", ").trim}}

 

Kind regards,
Bill

0 votes
Valerie Knapp
Community Champion
November 12, 2025

Hi @Pedro Paulo de Freitas Junior , thanks for your post.

Here,

{{#issue.comments.last.body.match("([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})")}}{{.}}, {{/}}

You are specifying only the latest / last comment, correct?

Why would there be more than one email address? I am curious.

Are you logging the results of the smart value?

Please share some screens of the rule configuration and the audit log of your tests so we can see better what you are doing and how you are doing it.

Best wishes 

Suggest an answer

Log in or Sign up to answer