Rundeck GMail SMTP not working

2,637 views
Skip to first unread message

Peter Kingswell

unread,
Jun 2, 2015, 9:09:14 PM6/2/15
to rundeck...@googlegroups.com
Hi,

this is a repost from Rundeck GMail SMTP not working over on SO.  Any help would be much appreciated!

Pete
------------------------------ 

just wondering if anyone's bumped into this one. I'm setting up Rundeck but can't get notification emails working. Here's the config:

grails.mail.host = "smtp.gmail.com"
grails
.mail.port = 465
grails
.mail.username = "pe...@blahblah.com"
grails
.mail.password = "blahblahblah"
grails
.mail.props = ["mail.smtp.starttls.enable":"true","mail.smtp.auth":"true","mail.smtp.socketFactory.port":"465","mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory","mail.smtp.socketFactory.fallback":"false"]

and here's the error:

2015-06-02 12:17:49,142 ERROR NotificationService - Error sending notification email to peter@blahblah.com for Execution 29: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 465; timeout -1;

I've poked holes at both 465 and 587 in the (Windows) firewall (in fact, I turned it off completely temporarily and got the same exception).

Any ideas? I'd hate to abort on Rundeck just because of this.  Oh, this is with latest (2.5.1).
Many thanks, Pete

Dhanasekaran Anbalagan

unread,
Jun 11, 2015, 10:18:36 PM6/11/15
to rundeck...@googlegroups.com
Hi Peter,

Have fixed the issue ?.

I am facing same issue with 2.5.1. 

can you guys please guide me. How to fix this.


2015-06-11 21:41:49,403 WARN  ExecutionJob - ExecutionJob: Execution not found with ID [74], will retry for up to 60 seconds...
2015-06-11 21:41:51,624 ERROR NotificationService - Error sending notification email to dh...@dhana.net for Execution 74: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 465; timeout -1;
  nested exception is:
java.net.UnknownHostException: "smtp.gmail.com". Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 465; timeout -1;
  nested exception is:
java.net.UnknownHostException: "smtp.gmail.com"
2015-06-11 21:41:52,125 ERROR NotificationService - Error sending notification email to dh...@dhana.net for Execution 74: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 465; timeout -1;
  nested exception is:
java.net.UnknownHostException: "smtp.gmail.com". Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 465; timeout -1;
  nested exception is:
java.net.UnknownHostException: "smtp.gmail.com"


-Dhanasekaran.

Ryan Sheftel

unread,
Nov 6, 2015, 8:47:39 PM11/6/15
to rundeck-discuss
I am having the same problem. My setup is the following:

Linux Mint OS
Rundeck v. 2.6.1

It is confirmed that sending emails using the smtp.gmail.com works becuase I use that with the Linux ssmtp command and everything works fine on port 587. Here is what I put into the run rundeck-config.properties file:

grails.mail.host="smtp.gmail.com"
grails
.mail.port=587
grails
.mail.username="us...@gmail.com"
grails
.mail.password="password"
grails
.mail.props=["mail.smtp.starttls.enable":"true","mail.smtp.auth":"true","mail.smtp.socketFactory.port":"587","mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory","mail.smtp.socketFactory.fallback":"false"]


I get the same error back:

2015-11-06 18:50:13,884 ERROR NotificationService - Error sending notification email to rsheftel@gmail.com for Execution 15: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 587; timeout -1;
  nested exception is:
 java.net.UnknownHostException: "smtp.gmail.com". Failed messages: com.sun.mail.util.MailConnectException: Couldn'
t connect to host, port: "smtp.gmail.com", 587; timeout -1;

  nested exception
is:
 java
.net.UnknownHostException: "smtp.gmail.com"

Any help would be very much appreciated.

Alexander Lehmann

unread,
Nov 7, 2015, 3:53:43 AM11/7/15
to rundeck-discuss
Unknown host usually indicates that there is typo in the smtp hostname (which isn't in this case) or the dns doesn't resolve the name.

You could try to telnet to the host/port on the machine you are trying to send the mails from, this should give something like:

> telnet smtp.gmail.com 587
Trying 74.125.133.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP kd8sm4046683wjc.27 - gsmtp

Alexander Lehmann

unread,
Nov 7, 2015, 3:56:53 AM11/7/15
to rundeck-discuss
Sorry, you said that it works with ssmtp, then the issue is apparently somewhere else.

Ryan Sheftel

unread,
Nov 7, 2015, 6:58:37 AM11/7/15
to rundeck-discuss
For completeness, yes the telnet command works.

Greg Schueler

unread,
Nov 7, 2015, 1:45:06 PM11/7/15
to rundeck...@googlegroups.com
Make sure to change to use .groovy config file format. The .properties won't work with the extended mail props. 

See the FAQ on GitHub wiki

-- 
Greg
--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/ffe403b6-3b0a-46ff-8279-91ebc7a14c72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Sheftel

unread,
Nov 7, 2015, 4:02:54 PM11/7/15
to rundeck-discuss
That worked! Thank you very much. To help others, here is the groovy config for gmail that worked for me. Note that it is missing the "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory" that I found on several other threads. When I had that in the props it did not work. Removing that part of the props lead to success.

grails {
  mail
{
    host
= "smtp.gmail.com"
    username
= "us...@gmail.com"
    port
= 587
    password
= "example"
    props
= ["mail.smtp.starttls.enable":"true","mail.smtp.auth":"true","mail.smtp.socketFactory.port":"587","mail.smtp.socketFactory.fallback":"false"]
 
}
}
grails
.mail.default.from = "us...@gmail.com"

John Mcintire

unread,
May 15, 2016, 11:58:42 PM5/15/16
to rundeck-discuss
I am completely unfamilar with the groovy file format. My understanding is that the groovy file substitutes the properties file, so all the properties in the properties file need to be translated into the groovy format.

I took a stab at it and spent a few hours trying to massage the groovy file to get it to work, but there is something (probably many things) wrong. I am getting (various) messages in the log (depending on the massaging of the file) that indicates that the program is seeing the file, but is unable to parse it.

I have attached my file (with all security info removed), can someone please take a look and tell me what is wrong with it? Alternatively, someone could just send me their version of the rundeck-config.groovy file and let me figure out what is wrong with mine.

thanks.
rundeck-config.groovy

Ashutosh Raikwar

unread,
Feb 16, 2017, 12:11:23 PM2/16/17
to rundeck-discuss
Hi,

if someone has get the working email functionality for rundeck.

If yes please let me know.

matthew....@fronde.com

unread,
Feb 16, 2017, 5:50:37 PM2/16/17
to rundeck-discuss
For me I removed all the mail config from within rundeck and allowed the server to process. 

All our servers relay to a dedicated mail server so this was a better option to fit into our infrastructure.

Matt.

Syed Munaz

unread,
Aug 16, 2023, 9:07:32 AM8/16/23
to rundeck-discuss
Hi Ryan

I have installed rundeck on windows platform

how do i configure gmail smtp and in which path should i create .groovy file

Regards,
Munaz.

rac...@rundeck.com

unread,
Aug 16, 2023, 9:44:39 AM8/16/23
to rundeck-discuss
Hi Munaz, 

Take a look at this. Anyway, right now isn't necessary. You can configure those parameters on the smtp config, take a look at this.

Regards.

Syed Munaz

unread,
Aug 17, 2023, 9:03:32 AM8/17/23
to rundeck-discuss
Hi Ryan,

Thanks for your reply.

rundeck is installed in windows, so i created a rundeck-config.groovy under c:\rundeck.  can you pls help me with exact path where should i create

Still it is taking localhost and port 25 and not gmail.

[2023-08-17T12:44:59,691] ERROR services.NotificationService [quartzScheduler_Worker-1] - Error sending notification email to syed.munaz@****.com for Execution 7: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
  nested exception is:
java.net.ConnectException: Connection refused: connect. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
  nested exception is:
java.net.ConnectException: Connection refused: connect

Regards,
Munaz.


Reply all
Reply to author
Forward
0 new messages