jenkins 如何配置邮件

jenkins 系统设置【extended email notification】配置如下图:

img

【邮件通知】配置如下图:

img

【系统管理员邮件地址】配置的邮件地址和email配置的相同

问题:

按如上配置后,无法收到邮件,jenkins日志如下:

DEBUG SMTP: MessagingException while sending, THROW: 
com.sun.mail.smtp.SMTPSendFailedException: 503 Error: need EHLO and AUTH first !
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 503 Error: need EHLO and AUTH first !

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2374)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1808)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1285)
    at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:524)
    at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:444)
    at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:354)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:755)
    at hudson.model.Build$BuildExecution.cleanUp(Build.java:188)
    at hudson.model.Run.execute(Run.java:1935)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:99)
    at hudson.model.Executor.run(Executor.java:432)
Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 503 Error: need EHLO and AUTH first !

    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1817)
    ... 12 more
Not sent to the following valid addresses: 45212312961@qq.com
SMTPSendFailedException message: 503 Error: need EHLO and AUTH first !

Next SMTPSenderFailedException message: 503 Error: need EHLO and AUTH first !

尝试过的解决方法

在网上看了贴在,【extended email notification】必须勾选 Use Stmp Authentication,然后填写用户名密码,但是我在【extended email notification】都没看到这些填写项,有人告诉我应该怎么解决吗

老哥,问题解决了吗,我跟你又遇到一样的问题,而且只有在构建后操作中选择 Editable email notification 才会有这个问题,选择默认的E-mail notification反而在构建失败时可以正常发送

我在全局那里配置好SMTP相关的东西就可以在自己的构建项目中调用。


实际工作中,一直都是用 钉钉或者微信 机器人告警,配置更快捷简单和实时。