2

我正在设置 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 处戳了洞(事实上,我暂时将其完全关闭并得到了同样的例外)。

4

1 回答 1

3

只是为了记录答案:目前您需要使用 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)的扩展功能。检查这个

于 2020-09-16T14:30:35.370 回答