Unable to send mail with Connection refused error in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  1. The mail queue in JIRA applications is not automatically flushing.
  2. 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

  1. Check that the SMTP is running on its host. If unsure, verify this with your System Administrator.
  2. See if you can send mail with a different application.
  3. 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.

    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.

    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.

    $ 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.

    $ 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!
  4. 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.
Last modified on Mar 10, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.