从 Jenkins 发送扩展电子邮件通知时出错
Error While Sending Extended email notification from Jenkins
我已经在 Jenkins 配置系统中配置了扩展的电子邮件通知,并创建了一个新作业并配置了可编辑的电子邮件通知,一旦构建完成,电子邮件就不会发送,并且在控制台中得到以下信息 Not sent to the following valid addresses: user@domain.com
这是调试日志
RSET
DEBUG SMTP: EOF: [EOF]
DEBUG SMTP: MessagingException while sending, THROW:
com.sun.mail.smtp.SMTPSendFailedException: 451 5.7.3 STARTTLS is required to send mail [PN********6.INDPRD01.PROD.OUTLOOK.COM]
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:541)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:446)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:354)
at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
at hudson.model.Run.execute(Run.java:1954)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Not sent to the following valid addresses: user@domain.com
SMTPSendFailedException message: 451 5.7.3 STARTTLS is required to send mail [P******06.INDPRD01.PROD.OUTLOOK.COM]
QUIT
DEBUG SMTP: EOF: [EOF]
这是我如何在配置系统中配置电子邮件通知的屏幕截图:
在 Windows 的 Jenkins.xml 文件中或 Ubuntu 的 /etc/default/jenkins 中添加此 Java 参数:
-Dmail.smtp.starttls.enable=true
或者,您可以尝试将 SMTP 端口从 587 更改为 465。在这种情况下应该使用 SSL。
参考:
Jenkins SMTP TLS
https://superuser.com/questions/879361/how-to-configure-jenkins-email-notifications-through-outlook
只需在 Jenkins 选项文件中配置:
JENKINS_JAVA_OPTIONS : -Djava.awt.headless=true -Dmail.smtp.starttls.enable=true
JENKINS_OPTS : -Dmail.smtp.starttls.enable=true
我已经在 Jenkins 配置系统中配置了扩展的电子邮件通知,并创建了一个新作业并配置了可编辑的电子邮件通知,一旦构建完成,电子邮件就不会发送,并且在控制台中得到以下信息 Not sent to the following valid addresses: user@domain.com
这是调试日志
RSET
DEBUG SMTP: EOF: [EOF]
DEBUG SMTP: MessagingException while sending, THROW:
com.sun.mail.smtp.SMTPSendFailedException: 451 5.7.3 STARTTLS is required to send mail [PN********6.INDPRD01.PROD.OUTLOOK.COM]
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:541)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:446)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:354)
at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
at hudson.model.Run.execute(Run.java:1954)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Not sent to the following valid addresses: user@domain.com
SMTPSendFailedException message: 451 5.7.3 STARTTLS is required to send mail [P******06.INDPRD01.PROD.OUTLOOK.COM]
QUIT
DEBUG SMTP: EOF: [EOF]
这是我如何在配置系统中配置电子邮件通知的屏幕截图:
在 Windows 的 Jenkins.xml 文件中或 Ubuntu 的 /etc/default/jenkins 中添加此 Java 参数:
-Dmail.smtp.starttls.enable=true
或者,您可以尝试将 SMTP 端口从 587 更改为 465。在这种情况下应该使用 SSL。
参考:
Jenkins SMTP TLS
https://superuser.com/questions/879361/how-to-configure-jenkins-email-notifications-through-outlook
只需在 Jenkins 选项文件中配置:
JENKINS_JAVA_OPTIONS : -Djava.awt.headless=true -Dmail.smtp.starttls.enable=true
JENKINS_OPTS : -Dmail.smtp.starttls.enable=true