Registering custom SMTPTransport in Confluence


I'm trying to register my own SMTPTransport-class in Confluence, so that I can do some custom actions when an outgoing E-Mail is about to be sent.

I already have a working library for Jira, that gets correctly registered and does the custom actions I want. Now I copied that over into a Confluence project, but it doesn't work there any longer. Whenever I try to send an email, an exception is thrown:

An error has occurred with sending the test email:
com.atlassian.mail.MailException: javax.mail.NoSuchProviderException: smtp
at com.atlassian.confluence.jmx.JmxSMTPMailServer.doSendWithMessageIdSupport(
at com.atlassian.confluence.jmx.JmxSMTPMailServer.send(
at com.atlassian.confluence.admin.actions.mail.SendTestEmailAction.execute(
at com.opensymphony.xwork.DefaultActionInvocation.invoke(
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(
at com.opensymphony.xwork.DefaultActionInvocation.invoke(
at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(
at com.opensymphony.xwork.DefaultActionInvocation.invoke(
... 245 more
Caused by: javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(
at javax.mail.Session.getTransport(
at javax.mail.Session.getTransport(
at javax.mail.Session.getTransport(
at com.atlassian.confluence.jmx.JmxSMTPMailServer.doSendWithMessageIdSupport(
... 361 more

Now I'm wondering why the same approach works in Jira, but not in Confluence, as the registering of the class has nothing to do with either Jira and Confluence, but with the underlying web-server. I was trying it on Confluence version 6.4, but it also didn't work in a lower version which I tried previously.

Here is what I did:

I added both those files into the META-INF directory src/main/resources



File: javamail.providers

protocol=smtp; type=transport; class=class.that.extends.SMTPTransport;

 And exported it as a jar file and copied it into the confluence/webapp/WEB-INF/lib folder. But somehow, it isn't recognized there.

I also tried copying the folder into the tomcat8/lib folder. There, the registration works and my class is at least about to get loaded. This then fails because it can't find imported classes (like com.sun.mail.smtp.SMTPTransport which it is extending).

I've googled a bit for the above mentioned exception, but all I could find is about an activation-library that is missing, but that is only for Java version 1.5 or lower. And for good measures, I tried it anyway, and it didn't work either.

So, my question now is, what am I doing wrong? What does it need so my SMTPTransport class is correctly loaded in Confluence? I really hope someone can help me there.

1 answer

1 accepted

0 vote

Well, after lots of searching, I finally found that it was a simple NullPointerException in my Constructor. But thanks to the excpetion getting somehow swallowed and not showing up, it was the last place I was looking for.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,916 views 27 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you