小编Rty*_*yUP的帖子

声明式管道发送电子邮件

我需要使用jenkins发送邮件通知(如果构建成功或发生错误)

现在我有这样的事情:

pipeline {
    agent any

...Some stages ...

post {
        success {
            mail to:"someone@hotmail.com", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Yay, we passed."
        }
        failure {
            mail to:"someone@hotmail.com", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Boo, we failed."
        }
    }   
}  
Run Code Online (Sandbox Code Playgroud)

但是当我执行时,出现以下错误:

java.net.ConnectException: Connection refused: connect
Caused: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
  nested exception is:
    java.net.ConnectException: Connection refused: connect
Run Code Online (Sandbox Code Playgroud)

我想我不能在端口25上发送,我需要在端口465上发送。我错了吗?但是我不知道该怎么办。

在大多数示例中,他们使用jenkins的插件,但我只能使用代码(声明性管道

建议?

email jenkins

5
推荐指数
1
解决办法
3844
查看次数

标签 统计

email ×1

jenkins ×1