Search code examples
jenkinscontinuous-integrationjenkins-pipelinejenkins-pluginscontinuous-deployment

Error While Sending Extended email notification from Jenkins


i have configured extended email notification in Jenkins configure system, and created a new job and configured editable email notification, once the build is completed, email is not sent and getting the following in console Not sent to the following valid addresses: [email protected]

and here is the debug log

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$1.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: [email protected]
SMTPSendFailedException message: 451 5.7.3 STARTTLS is required to send mail [P******06.INDPRD01.PROD.OUTLOOK.COM]

QUIT
DEBUG SMTP: EOF: [EOF]

Here is the screenshot how i configured email notification in Configure System: System - Email Configuration


Solution

  • Add this Java argument in Jenkins.xml file for Windows or in /etc/default/jenkins for Ubuntu:

    -Dmail.smtp.starttls.enable=true
    

    Alternatively, you can try to change the SMTP port from 587 to 465. Use SSL should be true in this case.

    Reference:
    Jenkins SMTP TLS
    https://superuser.com/questions/879361/how-to-configure-jenkins-email-notifications-through-outlook