Unable to send mail with Connection refused error in Jira server
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
:
1
2
3
4
5
6
7
8
9
10
11
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
Expand to see Windows instructions
Test that the server is reachable by pinging it.
1 2 3 4 5 6 7 8
C:\>ping -n 1 smtp-host Pinging smtp-host.potatobake.com [192.168.1.100] with 32 bytes of data: Reply from 192.168.1.100: bytes=32 time=4ms TTL=127 Ping statistics for 172.20.4.167: Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 4ms, Maximum = 4ms, Average = 4ms
Check that the port is open (typically 25). A successful connection to the port indicates it is open. If a successful connection is made, the screen will go blank. If not, the below message will be generated. To exit telnet, use CTRL+C.
1 2
C:\>telnet smtp-host 25 Connecting To smtp-host...Could not open connection to the host, on port 25: Connect failed
Linux
Expand to see Linux instructions
Test that the server is reachable by pinging it.
1 2 3 4 5 6 7
$ ping -c1 smtp-host PING smtp-host (192.168.1.100): 56 data bytes 64 bytes from 192.168.1.100: icmp_seq=0 ttl=127 time=0.521 ms --- crowd-ad1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.521/0.521/0.521/0.000 ms
Check that the port is open (typically 25). A successful connection to the port indicates it is open. To exit telnet, use CTRL+C.
1 2 3 4 5 6 7 8 9
$ telnet smtp-host 25 Trying 192.168.1.100... Connected to smtp-host. Escape character is '^]'. Or, use netcat(sudo apt-get install netcat) utility: $ nc -vnz -w 1 192.168.1.100 25 Connection to 192.168.1.100 25 port [tcp/*] succeeded!
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.
Was this helpful?