繁体   English   中英

如何使用Jenkins发送电子邮件通知?

[英]How to send email notification with Jenkins?

我想在构建失败时发送电子邮件。 我已经配置了系统管理员电子邮件地址 :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命令。


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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM