【问题标题】:How to send email notification with Jenkins?如何使用 Jenkins 发送电子邮件通知?
【发布时间】:2018-01-27 08:36:23
【问题描述】:

我想在构建失败时发送电子邮件。我已经配置了我的系统管理员电子邮件地址:test@gmail.com 和SMTP 服务器:smtp.gmail.com。


这是我的管道中的代码:


pipeline{
agent none
stages{
    stage('test'){
        agent{
            label 'VStest'
        }
        steps{
            script{
                //nothing
            }
        }
    }
}
post{
    always{
        mail to: 'test@gmail.com',
            subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
            body: "Something is wrong with ${env.BUILD_URL}"
        echo "sent"
      }
   }
}

我收到了错误:

com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 必须先发出 STARTTLS 命令。


有人知道为什么吗?谢谢。

【问题讨论】:

    标签: email jenkins jenkins-plugins jenkins-pipeline


    【解决方案1】:

    您使用的默认 SMTP 端口 (25) 不适用于 Gmail 帐户。尝试为 SSL 使用端口 465 或为 TLS 使用端口 587。

    本指南可能会有所帮助:http://www.360logica.com/blog/email-notification-in-jenkins/

    【讨论】:

    • 我已按照指南进行操作,但在“测试配置”按钮处出现错误。如果我使用端口 456,我得到: java.net.ConnectException: Connection timed out and with the port 587 : javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    • Nvm 我用的是 456 ...我的错
    猜你喜欢
    • 1970-01-01
    • 2012-10-11
    • 2019-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多