Search code examples
smtpgerrit

Gerrit Cannot send email verification message 504


I am using gerrit 3.2.1

After I tried everything I can do to configure my gerrit.sendemail, I failed to send a verification mail

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

I refered to https://groups.google.com/forum/#!msg/repo-discuss/RWvdXR-Z4nA/1USSK1F6AAAJ\

but seems I met different problem,

For the encryption, according with office 365, the SMTP uses STARTTLS, but seems it always fail. I tried ssl, tls, neither works. I also tried port 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)

Solution

  • Is this related to this question on the mailing list?

    Also, when I check the office365 smtp settings it looks like it should use tls instead of 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)
    

    Try to change your settings to tls and maybe you need to implement the workaround for java11.