Unable to set up SMTP mail server
Asked by Nibu Thomas:

I'm trying to set up notifications and need to configure SMTP. We use a paid version of Gmail and I entered all the required details but when I try to send a test email, I get a really large time out message. My server hostname is smtp.gmail.com. I'm using 465 server port with TLS enabled.

Here's the error. It's long and it wouldn't take the entire message. So I've included the top part and the bottom part and removed the biggest portion in between...

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 com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)  
at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:33)  
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)  
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)

<br />

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:45)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.impl.vcache.VCacheRequestContextFilter.lambda$doFilter$3(VCacheRequestContextFilter.java:44)  
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)  
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)  
at com.atlassian.confluence.impl.vcache.VCacheRequestContextFilter.doFilter(VCacheRequestContextFilter.java:43)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.util.LoggingContextFilter.doFilter(LoggingContextFilter.java:33)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:65)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.github.kristofa.brave.servlet.BraveServletFilter.doFilter(BraveServletFilter.java:59)  
at com.atlassian.confluence.web.filter.ZipkinTracingFilter.doFilter(ZipkinTracingFilter.java:52)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.web.filter.ResponseOutputStreamFilter.doFilter(ResponseOutputStreamFilter.java:23)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:72)  
at com.atlassian.confluence.web.ConfluenceJohnsonFilter.doFilter(ConfluenceJohnsonFilter.java:33)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.impl.servlet.HoldingUntilStartedFilter.doFilter(HoldingUntilStartedFilter.java:88)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:64)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:46)  
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)  
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)  
at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)  
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)  
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)  
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)  
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)  
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)  
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)  
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)  
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.lang.Thread.run(Thread.java:745)  
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)  
... 359 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:170)  
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)  
... 365 more


Answers:
author: Nibu Thomas
body: Anyone?


author: Nibu Thomas
body: Anything else I can do to set up email so notifications start to work?


author: Milan Chheda [INFOSYSTA]
body: It looks like your server is not able to connect to the SMTP details.

1. Can you verify if the mentioned port is open from your server?
2. Can you telnet from your server to the mentioned SMTP host on the mentioned port?

comments: author: Nibu Thomas
body: I needed help from IT, sorry for the delay.

The port is open. And we can telenet from the server to the SMTP host.

So what could be the issue?

One strange thing I notice is even after deleting the smtp details, when I try to add it again, the old stuff still shows up. I've tried clearing cache, nothing seems to change this. But it's actually using the new information (which can be confirmed in the message when we try to send test email.