How to set FROM in Script Custom Email post function

Vikrant Yadav
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 1, 2021

Hi Guys,

Need help!

I am using post function  Script Custom Email. But default system is sending from jira@noreply.com . I want to change from Email Address in Scripted Custom Email. How can i change from . Kindly suggest.

 

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Payne
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.
June 1, 2021

Do you mean "Send a custom email [ScriptRunner]"? If so, in the "Condition and Configuration" section you can modify the predefined "mail" variable like so:

mail.setFrom("somebody@gmail.com")

See this documentation and note there are several set___() methods.

Vikrant Yadav
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 1, 2021

Hi @Payne Thanks for your response. I was not aware where to add mail.setFrom , i was adding in Body..not tried in condition and configuration. 

It's fixed now. I have set reporter in setFrom.

 

import com.atlassian.mail.Email
mail.setFrom("$issue.reporter.emailAddress")
mail.setReplyTo("$issue.reporter.emailAddress")

 Thanks!

Vikrant Yadav
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 1, 2021

Hello @Payne  One last question realated to same issue. 

Now email is going through from reporter email address. 

I want to add comment as well JIRA issue. Like when someone complete the task and reply on the same email shooted from jira. Then how reply of an email added as comment in same JIRA issue ? Kindly suggest

 

Thanks

Payne
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.
June 2, 2021

There is another predefined variable, lastComment that contains the comment made during this transition, or null if there is not one. You can use that variable in the Email Template as $lastComment, perhaps checking for null and not displaying it if that is the case.

Vikrant Yadav
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 2, 2021

Hi @Payne I think I am not able to explain my issue correctly. 
 
I want to add comment in jira issue when some one reply on the email which sent from JIRA where from is reporter . If reply back to reporter email then that reply added to comment ? 

Payne
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.
June 2, 2021

Ah, that's a totally different topic. You may wish to create a new question about that particular issue.

Suggest an answer

Log in or Sign up to answer