Confluence is unable to connect to the mail server (response code 421)

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

Problem

Confluence cannot reach the mail server, returns code 421 error which indicates that the service is not available and the connection will be closed.

The following appears in the atlassian-confluence.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 2012-12-05 16:02:00,105 ERROR [scheduler_Worker-9] [atlassian.core.task.AbstractErrorQueuedTaskQueue] handleException com.atlassian.mail.MailException: javax.mail.MessagingException: Could not connect to SMTP host: 192.168.27.25, port: 2526, response: 421 com.atlassian.mail.MailException: javax.mail.MessagingException: Could not connect to SMTP host: 192.168.27.25, port: 2526, response: 421 at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:191) at com.atlassian.confluence.jmx.JmxSMTPMailServer.send(JmxSMTPMailServer.java:71) at com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem.send(AbstractMailNotificationQueueItem.java:128) at com.atlassian.confluence.mail.template.PreRenderedMailNotificationQueueItem.send(PreRenderedMailNotificationQueueItem.java:117) at com.atlassian.confluence.mail.template.AbstractMailNotificationQueueItem.execute(AbstractMailNotificationQueueItem.java:99) at com.atlassian.core.task.AbstractErrorQueuedTaskQueue$TaskDecorator.execute(AbstractErrorQueuedTaskQueue.java:107) at com.atlassian.core.task.AbstractTaskQueue.flush(AbstractTaskQueue.java:45) at com.atlassian.core.task.AbstractErrorQueuedTaskQueue.flush(AbstractErrorQueuedTaskQueue.java:37) at com.atlassian.quartz.jobs.TaskQueueFlushJob.doExecute(TaskQueueFlushJob.java:32) at com.atlassian.quartz.jobs.AbstractJob.executeInternal(AbstractJob.java:86) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at com.atlassian.confluence.setup.quartz.DelegatingClusterAwareQuartzJobBean.executeJob(DelegatingClusterAwareQuartzJobBean.java:16)

Diagnosis

  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 an application other than Confluence.

  3. Check the physical connection from the Confluence 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 $ telnet smtp-host 25 Trying 192.168.1.100... Connected to smtp-host. Escape character is '^]'.
  4. If you're unable to connect to the SMTP host from the JIRA host, it may indicate a problem with the network. Please check this with your hosting provider or System Administrator.

Cause

The Mail Sever is not available/reachable.

Resolution 1

Re-create the SMTP server settings in Confluence Admin > Mail Server.

Resolution 2

If the above does not work, move the 'activation' and 'mail' jar files from /confluence/WEB-INF/lib to <Confluence Standalone install>/lib, restart Confluence and see if the problem persists.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.