Rundeck Gmail SMTP无法正常工作 - smtp.gmail.com未知主机

时间:2016-05-05 17:58:40

标签: smtp rundeck

我想配置Rundeck以允许电子邮件通知。

我的rundeck-config.properties是:

grails.mail.host = "smtp.gmail.com"
grails.mail.username = "name@domain.com"
grails.mail.port = 465
grails.mail.password = "******"
grails.mail.props = ["mail.smtp.starttls.enable":"true","mail.smtp.auth":"true","mail.smtp.socketFactory.port":"465","mail.smtp.socketFactory.fallback":"false"]

当我运行Job时,我得到的错误是:

2016-05-05 14:49:30,557 ERROR NotificationService - Error sending notification email to me@gmail.com for Execution 11: Mail ser
ver connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: "smtp.gmail.com", 465; ti
meout -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"

我尝试了在Google上找到的所有内容,但错误保持不变。

我也试过telnet smtp.gmail.com 465并且它有效

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您必须在.properties文件中支持使用.groovy文件作为道具

下面是我的rundeck-config.groovy文件,它正常工作

loglevel.default="INFO"
rdeck.base="/var/lib/rundeck"
rss.enabled=false

dataSource.dbCreate = "update"
dataSource.url = "jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true;TRACE_LEVEL_FILE=4"
grails {
  mail {
        host = "smtp.gmail.com"
        username = "************"
        port = 587
        password = "*********"
        props = ["mail.smtp.starttls.enable":"true","mail.smtp.auth":"true","mail.smtp.socketFactory.port":"587","mail.smtp.socketFactory.fallback":"false"]
  }
}
grails.serverURL="http://***.***.***.***:4440"

参考:https://github.com/rundeck/rundeck/issues/1607