簡體   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