It's all about the answers!

Ask a question

Email notification through Gmail: Connection Timeout to smtp.gmail.com:587


Victor Rentea (6111) | asked Aug 18 '14, 4:50 a.m.
I get the following error
[ERROR] Sending the email to the following server failed : smtp.gmail.com:587: Could not connect to SMTP host: smtp.gmail.com, port: 587: Connection timed out -> [Help 1]

The plugin I'm trying to use to send the mail is the following:
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<executions>
<execution>
<id>send a mail</id>
<phase>package</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>false</inherited>
<configuration>
<from>library.ci.build@gmail.com</from>
<subject>Build ${env.BUILD_NUMBER}</subject>
<failonerror>true</failonerror>
<mailssl>true</mailssl>
<mailcontenttype>text/html</mailcontenttype>
<mailhost>smtp.gmail.com</mailhost>
<!-- to get out of Jazz: 587 -->
<mailport>587</mailport>
<mailuser>XXX</mailuser>
<mailpassword>XXX</mailpassword>
<mailAltConfig>true</mailAltConfig>
<htmlMessage>Build page here: &lt;a href="https://hub.jazz.net/pipeline/corneliupetrescu/LibraryBackend/builds/4acc9fca-7562-4546-af3b-3e6b36c1ab48/${TASK_ID}"&gt;https://hub.jazz.net/pipeline/corneliupetrescu/LibraryBackend/builds/4acc9fca-7562-4546-af3b-3e6b36c1ab48/${TASK_ID}&lt;/a&gt;</htmlMessage>
<receivers>
<!-- <receiver>${git.commit.user.email}</receiver> -->
<receiver>victorrentea@gmail.com</receiver>
</receivers>

</configuration>
</execution>
</executions>
</plugin>

From my local machine, this works OK.

Do you have any idea? Please help.

4 answers



permanent link
Simon Washbrook (67216) | answered Aug 18 '14, 5:09 a.m.
Hi Victor,

According to https://support.google.com/a/answer/176600?hl=en
The port for SSL connections is 465. 587 is for TLS connections.

Cheers, Simon

permanent link
Victor Rentea (6111) | answered Aug 18 '14, 5:17 a.m.
Hi Simon,

Thank you for your answer !

You're right. I've mixed the two. I tried again:
<mailssl>true</mailssl>
<mailport>465</mailport> 
and
<mailssl>false</mailssl>
<mailport>587</mailport> 
Both configurations hang for ~1 min when sending the mail, and then result in error:
[ERROR] Sending the email to the following server failed : smtp.gmail.com:587: Could not connect to SMTP host: smtp.gmail.com, port: 587: Connection timed out
I suspect that there is some port blocking in place, but I don't know how to work around it. I say this because I've tried to set the server to www.gmail.com : 80 and there was some response (that caused an error afterall) -- but at least there was some response from the remote server.

Thank you!
Victor

permanent link
Simon Washbrook (67216) | answered Aug 18 '14, 5:27 a.m.
Hi Victor, to check if there is a firewall blocking your access to these ports, try the following command from a DOS window (on Windows) or a terminal window (Linux or Unix).
telnet smtp.gmail.com 587

You should see the response:
220 mx.google.com ESMTP c8sm40836399wjw.6 - gsmtp

On Windows type "Ctrl+$" then "quit" to exit "telnet"
On Linux and Unix type "Ctrl+]" then "quit" to exit "telnet"

If you do not see the reply from google then something on your network is blocking the port. Ask your system administrator.

Cheers, Simon

Comments
Victor Rentea commented Aug 18 '14, 5:29 a.m.

Unfortunately I don't have SSH access on the Jenkins server that runs the maven build :(
Do you know how I can connect via SSH to the Jenkins server undelying Jazz ?
Thanks,
Victor


permanent link
Simon Washbrook (67216) | answered Aug 18 '14, 5:38 a.m.
Sorry, you will have to talk to your server administrator, you will need access to the server that is contacting Google in order to debug this problem. If you can not have direct access, maybe your server administrator can run the commands; The server administrator will also know if there is a firewall setup on the server or between the server and the internet that could block these outgoing requests.
Cheers,
Simon

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.