You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi All,
I have one query from the users that they need to send an automatic email to the reporter if issue not updated from last 3 days. In order to achieve this i am using Script Runner escalation services. i have tested action like transition this issue, or set a comment. these are working fine in escalation but when i am Email Script, it's not working. Please suggest, how can i send email from escalation services as a additional action.
Please suggest where am i doing wrong?
@Thanos Batagiannis [Adaptavist] @Martin Bayer _MoroSystems_ s_r_o__
Hi @Vikrant Yadav I'm using exactly the same script as you and it is working. So what about log file? Is "Mail sent" logged? Adjust the code to use log.error to be sure it is logged...
Hi @Martin Bayer _MoroSystems_ s_r_o__ getting below message in logs :-
Not sure what's going wrong..
Not getting message Mail Sent. Please suggest mate
Time (on server): Fri Nov 13 2020 11:48:15 GMT+0530 (India Standard Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2020-11-13 00:18:15,187 ERROR [jobs.EscalationService]: Escalation Service (Escalation mail to reporter) failed for issue CJS-2 java.util.ServiceConfigurationError: javax.mail.Provider: Provider com.sun.mail.imap.IMAPProvider not found at com.atlassian.mail.server.managers.AbstractMailServerManager.getSession(AbstractMailServerManager.java:56) at com.atlassian.mail.server.AbstractMailServer.getSessionFromServerManagerInternal(AbstractMailServer.java:445) at com.atlassian.mail.server.AbstractMailServer.getSessionFromServerManager(AbstractMailServer.java:428) at com.atlassian.mail.server.impl.SMTPMailServerImpl.getSession(SMTPMailServerImpl.java:157) at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:180) at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:174) at com.atlassian.mail.server.SMTPMailServer$send.call(Unknown Source) at Script106.sendEmail(Script106.groovy:17) at Script106.run(Script106.groovy:23) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScriptAndGetContext(AbstractScriptRunner.groovy:174) at com.onresolve.scriptrunner.runner.AbstractScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScriptAndGetContext(AbstractScriptRunner.groovy:293) at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$12.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.utils.ConditionUtils.doAdditional(ConditionUtils.groovy:112) at com.onresolve.scriptrunner.canned.jira.utils.ConditionUtils$doAdditional$0.call(Unknown Source) at com.onresolve.scriptrunner.workflow.DefaultWorkflowScriptExecutor.doAdditional(DefaultWorkflowScriptExecutor.groovy:29) at com.onresolve.scriptrunner.workflow.WorkflowScriptExecutor$doAdditional$0.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.utils.WorkflowUtil.updateIssue(WorkflowUtil.groovy:388) at com.onresolve.scriptrunner.canned.jira.utils.WorkflowUtil.updateIssue(WorkflowUtil.groovy) at com.onresolve.scriptrunner.canned.jira.utils.WorkflowUtil$updateIssue$0.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService$_execute_closure2$_closure5$_closure6.doCall(EscalationService.groovy:161) at com.sun.proxy.$Proxy3301.accept(Unknown Source) at java_util_function_Consumer$accept.call(Unknown Source) at com.onresolve.jira.groovy.jql.AbstractPagerExecutor$_forEachInternal_closure2.doCall(AbstractPagerExecutor.groovy:68) at com.onresolve.jira.groovy.jql.AbstractPagerExecutor.forEachInternal(AbstractPagerExecutor.groovy:67) at com.onresolve.jira.groovy.jql.PagerExecutor.forEachIssue(PagerExecutor.groovy:26) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService$_execute_closure2$_closure5.doCall(EscalationService.groovy:137) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService$_execute_closure2$_closure5.doCall(EscalationService.groovy) at com.onresolve.scriptrunner.jobs.JiraIdentitySwitchingService.switchIndentityAndExecuteInternal(JiraIdentitySwitchingService.groovy:45) at com.onresolve.scriptrunner.jobs.JiraIdentitySwitchingService.switchIndentityAndExecute(JiraIdentitySwitchingService.groovy:27) at com.onresolve.scriptrunner.jobs.IdentitySwitchingService$switchIndentityAndExecute.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService$_execute_closure2.doCall(EscalationService.groovy:135) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService$_execute_closure2.doCall(EscalationService.groovy) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl$_execute_closure1.doCall(DiagnosticsManagerImpl.groovy:350) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl$_execute_closure1.doCall(DiagnosticsManagerImpl.groovy) at com.onresolve.scriptrunner.runner.ScriptExecutionRecorder.withRecording(ScriptExecutionRecorder.groovy:13) at com.onresolve.scriptrunner.runner.ScriptExecutionRecorder$withRecording.call(Unknown Source) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl.execute(DiagnosticsManagerImpl.groovy:348) at com.onresolve.scriptrunner.runner.diag.DiagnosticsExecutionHandler$execute$2.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService.execute(EscalationService.groovy:133) at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService.execute(EscalationService.groovy)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you try to change your import from
import com.atlassian.mail.Email
to
import com.atlassian.jira.mail.Email
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Martin Bayer _MoroSystems_ s_r_o__ same above is working fine now.
Thanks Mate!
import com.atlassian.mail.Email
import com.atlassian.mail.server.MailServerManager
import com.atlassian.mail.server.SMTPMailServer
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
def subject = "${issue.key} = ${issue.summary}"
def body = "test"
def emailAddr = issue.getReporter().getEmailAddress()
def sendEmail(String emailAddr, String subject, String body) {
def mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()
if (mailServer) {
Email email = new Email(emailAddr);
email.setMimeType("text/html")
email.setSubject(subject);
email.setBody(body);
mailServer.send(email);
log.error("Mail sent")
} else {
log.warn("Please make sure that a valid mailServer is configured")
}
}
sendEmail (emailAddr,subject, body)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.