Gerrit 无法发送电子邮件验证消息 504

Gerrit Cannot send email verification message 504

我正在使用 gerrit 3.2.1

在我尽我所能配置我的 gerrit.sendemail 之后,我未能发送验证邮件

[sendemail]
        enable = true
        smtpServer = smtp.offce365.com
        smtpServerPort = 587
        smtpEncryption = ssl
        sslVerify = false
        smtpUser = gerrit@gerritserver.com
        smtpPass = pswd

我参考了https://groups.google.com/forum/#!msg/repo-discuss/RWvdXR-Z4nA/1USSK1F6AAAJ\

但我似乎遇到了不同的问题,

对于加密,根据office 365,SMTP使用STARTTLS,但似乎总是失败。我试过 ssl、tls,都不起作用。 我也试过端口 25.

[2020-06-16T14:33:53.834+0800] [WorkQueue-2] INFO com.googlesource.gerrit.plugins.deleteproject.fs.RepositoryCleanupTask : Cleaning up expired git repositories... Done
[2020-06-16T14:35:32.927+0800] [plugin-manager-preloader] INFO com.googlesource.gerrit.plugins.manager.OnStartStop : 66 plugins successfully pre-loaded
[2020-06-16T14:36:13.420+0800] [HTTP PUT /accounts/self/emails/name%40emailhost.com (flynn from 127.0.0.1)] ERROR com.google.gerrit.server.restapi.account.CreateEmail : Cannot send email verification message to name@emailhost.com
com.google.gerrit.exceptions.EmailException: Mail Error: Connection timed out (Connection timed out)
        at com.google.gerrit.server.mail.send.SmtpEmailSender.open(SmtpEmailSender.java:437)
        at com.google.gerrit.server.mail.send.SmtpEmailSender.send(SmtpEmailSender.java:207)
        at com.google.gerrit.server.mail.send.OutgoingEmail.send(OutgoingEmail.java:225)
        at com.google.gerrit.server.restapi.account.CreateEmail.apply(CreateEmail.java:164)
        at com.google.gerrit.server.restapi.account.CreateEmail.apply(CreateEmail.java:121)
        at com.google.gerrit.server.restapi.account.CreateEmail.apply(CreateEmail.java:71)

这与邮件列表中的this question有关吗?

此外,当我检查 office365 smtp 设置时,它看起来应该使用 tls 而不是 ssl:

SMTP Host: smtp.office365.com
SMTP Port: 587
SSL Protocol: OFF
TLS Protocol: ON
SMTP Username: (your Office365 username)
SMTP Password: (your Office365 password)

尝试将您的设置更改为 tls,也许您需要实施 java11 的解决方法。

当我在 3 年后回到这里时,还有 1 个提示...... 我遇到了另一个类似现象的问题。

原来有些邮件服务器要求字段 'from' 必须等于 'smtpUser'.