Unable to send mail with Connection refused error in Jira server
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
- The mail queue in JIRA applications is not automatically flushing.
- When attempting to send any mail from JIRA applications, mail is not being successfully sent.
The following appears in the atlassian-jira.log
:
2012-07-31 12:27:16,486 ERROR [mail.potatobake.com] Sending mailitem To='sir.lancelot@potatobake.com' Subject='(LOL-1337) Batman to Robin' From='null' FromName='Batman' Cc='null' Bcc='null' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='null' MessageId='null' david.tweet 745x4172376x138 17n240g 10.61.131.173,127.0.0.1 /secure/admin/MailQueueAdmin.jspa Error occurred in sending e-mail: To='sir.lancelot@potatobake.com' Subject='(LOL-1337) JCA to PHX' From='null' FromName='Batman' Cc='null' Bcc='null' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='null' MessageId='null'
com.atlassian.mail.MailException: javax.mail.MessagingException: Could not connect to SMTP host: mail.potatobake.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:183)
at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:38)
at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:66)
at com.atlassian.jira.web.action.admin.MailQueueAdmin.doExecute(MailQueueAdmin.java:57)
at webwork.action.ActionSupport.execute(ActionSupport.java:165)
at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39)
at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31)
at webwork.interceptor.ChainedInterceptor.intercept(ChainedInterceptor.java:16)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:35)
at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:205)
at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:143)
at com.atlassian.jira.web.dispatcher.JiraWebworkActionDispatcher.service(JiraWebworkActionDispatcher.java:151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:78)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)
at com.atlassian.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:36)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)
...
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.potatobake.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:154)
... 131 more
It can also display the following message in jira-outgoing-mail.log
:
com.atlassian.mail.MailException: javax.mail.MessagingException: Could not connect to SMTP host: <HOST>, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:169)
at com.atlassian.jira.web.action.admin.mail.SendTestMail.doExecute(SendTestMail.java:93)
...
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: <HOST>, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
...
Cause
This indicates that an error occurred while attempting to connect a socket to the SMTP server. Typically this is caused due to no mail server running on that port or host or a network problem.
Resolution
- Check that the SMTP is running on its host. If unsure, verify this with your System Administrator.
- See if you can send mail with a different application.
- Check the physical connection from the JIRA application box to the SMTP host with the following:
Windows
Linux
- If you're unable to connect to the SMTP host from the JIRA application host, it may indicate a problem with the network. Please check this with your hosting provider or System Administrator.