Outgoing SMTP not Sending out Mail

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

JIRA is throwing a java.net.ConnectException when attempting to send mail through the SMTP.

After enabling the Outgoing Mail log in Administration > System > Troubleshooting and Support > Logging and Profiling, the following error logs message appears in the atlassian-jira-outgoing-mail.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 com.atlassian.mail.MailException: javax.mail.MessagingException: Could not connect to SMTP host: VIAMASCPH011.no.via.as, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:201) at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:44) at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:66) at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:28) at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61) at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:47) at org.quartz.core.JobRunShell.run(JobRunShell.java:195) at com.atlassian.multitenant.quartz.MultiTenantThreadPool$MultiTenantRunnable.run(MultiTenantThreadPool.java:72) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) Caused by: javax.mail.MessagingException: Could not connect to SMTP host: VIAMASCPH011.no.via.as, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect 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:295) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:172) ... 8 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:319) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:233) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1938) ... 13 more

Verification

Anti-virus is installed on the JIRA server and all the below troubleshooting steps have been followed:

  1. Checked all the outgoing SMTP mail server settings (all correct).

  2. No SSL / Proxy / Firewall is being configured in the environment.

  3. Set up a test Gmail account as outgoing SMTP mail server (not working, error: connection timeout).

  4. Ping the SMTP telnet port (all working fine, port is open and connection is established and able to get through and received reply).

  5. Increase the timeout value but still keep getting error: connection timeout.

Cause

This is actually due to the anti-virus running on the JIRA server environment which could possibly block the connection between JIRA to the mail server.

Resolution

  1. Identify which tomcat process is running in the background for JIRA (this can be checked in Task Manager > Processes). This will typically be tomcat.exe, tomcat5.exe, tomcat5w.exe, tomcat6.exe, tomcat7.exe, for example:

    (Auto-migrated image: description temporarily unavailable)
  2. Set the exception for the tomcat process that you are running with JIRA in the anti-virus.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.