Search code examples
grailsgmailrundeck

Rundeck GMail SMTP not working


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 = "peter@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).


Solution

  • Just for the record answer: Currently you need to create a rundeck-config.groovy file (at /etc/rundeck path) with Gmail server configuration (only the email configuration) like this:

    grails {
      mail {
        host = "smtp.gmail.com"
        username = "username@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 = "username@gmail.com"
    
    

    The main reason of this is that .config file by design doesn't support extended features by external provider like gmail or office365. Check this.