Rundeck GMail SMTP无法正常工作

时间:2015-06-02 16:28:32

标签: grails gmail rundeck

我正在设置Rundeck,但无法收到通知电子邮件。这是配置:

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"]

并且出现了错误:

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;

我已经在(Windows)防火墙的465和587处戳了一个洞(事实上,我暂时将其关闭并得到了同样的例外)。

1 个答案:

答案 0 :(得分:1)

仅作记录的答案:当前,您需要使用以下Gmail服务器配置(仅电子邮件配置)创建rundeck-config.groovy文件(在/etc/rundeck路径):

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"

主要原因是设计上的.config文件不支持gmail或office365之类的外部提供程序的扩展功能。选中this