Forums

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

Unable to send email from script

AnupamS December 16, 2020

Hi community,

 

We recently upgraded our stage to 8.13.1. I am trying to run a script (Scriptrunner console) that is supposed to send an email but it is throwing exception. 

 

Similar script used to work for 7.13X version.

SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()
Email email = new Email("my_email_address")
email.setSubject("test")
email.setBody("body-test")
email.setMimeType("text/html")
mailServer.send(email)

 

and exception is:

java.util.ServiceConfigurationError: javax.mail.Provider: Provider com.sun.mail.imap.IMAPProvider not found at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at javax.mail.Session.loadProviders(Session.java:964) at javax.mail.Session.<init>(Session.java:254) at javax.mail.Session.getInstance(Session.java:281) 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 Script15.sendEmail(Script15.groovy:29) at Script15.run(Script15.groovy:38) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) at javax.script.ScriptEngine$eval.call(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScriptAndGetContext(AbstractScriptRunner.groovy:174) at com.onresolve.scriptrunner.runner.AbstractScriptRunner$runScriptAndGetContext$1.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScriptAndGetContext(AbstractScriptRunner.groovy:293) at com.onresolve.scriptrunner.runner.AbstractScriptRunner$runScriptAndGetContext$0.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScript(AbstractScriptRunner.groovy:305) at com.onresolve.scriptrunner.runner.rest.common.UserScriptEndpoint$_execFromJson_closure2.doCall(UserScriptEndpoint.groovy:156) at com.onresolve.scriptrunner.runner.rest.common.UserScriptEndpoint$_execFromJson_closure2.doCall(UserScriptEndpoint.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)

 

Let me know what do I need to do to avail this. I even tried the one that comes from Adaptavist library but that also threw this error. I am not sure why it is complaining about IMAP server as it should require SMTP server alone which is already configured.

 

Thank you in advance,

 

Anupam.

 

 

1 answer

0 votes
Raynard Rhodes
Contributor
December 16, 2020

Suggest an answer

Log in or Sign up to answer