Configuring SMTP Email for Confluence
Asked by jim:

Hi,

We are in process of reviewing a couple of Atlassian's products in order to transition from ClearQuest and ClearCase. Currently we have a Confluence license for a small number of a users and JIRA Software on a trial license.

I was able to configure JIRA SMTP email without a problem, but was unsuccessful doing this with Confluence. I noticed in the JIRA configuration it had protocol option for Secure SMTP where Confluence did not. We are using Secure SMTP with TLS (which is checked for each configuration). The systems are running on different servers, but I am told it is not a firewall issue on the Confluence server. I need to know if this is a limitation of Confluence if it cannot connect to an SMTP server that is using a secure protocol. I have seen many references to this when I Googled the issue. Below is the error I received when trying to test the connection.

Thanks,

Jim

An error has occurred with sending the test email:  
com.atlassian.mail.MailException: javax.mail.MessagingException: Exception reading response;  
nested exception is:  
java.net.SocketTimeoutException: Read timed out  
at com.atlassian.confluence.jmx.JmxSMTPMailServer.doSendWithMessageIdSupport(JmxSMTPMailServer.java:120)  
at com.atlassian.confluence.jmx.JmxSMTPMailServer.send(JmxSMTPMailServer.java:79)  
at com.atlassian.confluence.admin.actions.mail.SendTestEmailAction.execute(SendTestEmailAction.java:57)  
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)  
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)  
at cExecutor.java:624)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: javax.mail.MessagingException: Exception reading response;  
nested exception is:  
java.net.SocketTimeoutException: Read timed out  
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2210)  
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1950)  
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.confluence.jmx.JmxSMTPMailServer.doSendWithMessageIdSupport(JmxSMTPMailServer.java:102)  
... 363 more  
Caused by: java.net.SocketTimeoutException: Read timed out  
at java.net.SocketInputStream.socketRead0(Native Method)  
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)  
at java.net.SocketInputStream.read(SocketInputStream.java:171)  
at java.net.SocketInputStream.read(SocketInputStream.java:141)  
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)  
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)  
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)  
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89)  
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2188)  
... 369 more


Answers:
author: ??? (Will Hwang)
body: [@AnnWorley](/t5/user/viewprofilepage/user-id/502040)   
Hello AnnWorley

I'm will

Has this issue been resolved?  
I'm going through the same thing.

Best Regards,

Will


author: AnnWorley
body: James, you were right, TLS on port 587 is not the same as secure SMTP on 465. Confluence only supports the former while the latter is configurable on Jira as you reported.

Here is the related ticket for the issue, in case anyone wants to vote, comment or watch it: [Support SMTPs(465 port)](https://jira.atlassian.com/browse/CONFSERVER-43330)


author: AnnWorley
body: Confluence can connect securely to SMTP. I usually use Google's SMTP server for testing. It does run over TLS but you have to make sure to put in the port that the email server is using for TLS. Please see [How do I configure Confluence to use Gmail as the mail server?](https://confluence.atlassian.com/confkb/how-do-i-configure-confluence-to-use-gmail-as-the-mail-server-42795030.html)

The message you posted is a timeout and not an authentication or connection refused error:

```
Caused by: java.net.SocketTimeoutException: Read timed out
```

Please make sure the network connectivity is working between the Confluence server and the email server.

comments: author: jim
body: We have verified that the mail server can be reached on the port in question as we have another application on the same server that is doing so. All the parameters are correctly set, same as the outgoing mail on our JIRA server, but not with the same results. We even tried two different accounts to authenticate with the same result. The only difference I see is that in JIRA you have the option of choosing the protocol (**SMTP** or **Secure SMTP** ). In Confluence that option does not exist and we have **Secure SMTP** selected in JIRA). Both have the TLS checkbox which is selected in both cases along with the same port. If I change the protocol in JIRA to **SMTP** then I get the exact same error (below) I am getting in Confluence . It works in JIRA when I change the protocol to **Secure SMTP**, which is not an option in Confluence.

Unfortunately no connection was possible. Review the errors below and rectify:

* SocketTimeoutException: Read timed out


author: AnnWorley
body: Hi James,

I opened a support request so we could take a closer look at your logs and configuration files. You may expect an email from our support portal shortly. Once we get it sorted via that channel we can update this thread with the root cause.

thanks,

Ann


author: Troy Underwood
body: looking forward to your update.