Reputation: 602
I want to send a email when my build failed. I've configured my System Admin e-mail address : [email protected] and SMTP server : smtp.gmail.com.
Here's my code in my pipeline :
pipeline{
agent none
stages{
stage('test'){
agent{
label 'VStest'
}
steps{
script{
//nothing
}
}
}
}
post{
always{
mail to: '[email protected]',
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
echo "sent"
}
}
}
I'm getting the error :
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first.
Someone knows why? Thx.
Upvotes: 0
Views: 2994
Reputation: 15180
You are using the default SMTP port (25) which will not work with a Gmail account. Try using port 465 for SSL or port 587 for TLS.
This guide might help: http://www.360logica.com/blog/email-notification-in-jenkins/
Upvotes: 2