Configuring mail server in Jenkins ( Gmail ) - DeekshithSN/CICD_Java_gradle_application GitHub Wiki
Pre-requisite
- running Jenkins server
- Gmail account with insecure apps enabled
setup
Install Email Extension Plugin
in Jenkins
Once plugin installed in jenkins, click on manage jenkins --> configure system there under E-mail Notification section configure the details as shown in below image
this is to just verify mail configuration
Now under Extended E-mail Notification section configure the details as shown in below images
By using below code i can send customized mail
post {
always {
mail bcc: '', body: "<br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "[email protected]";
}
}
also which ever the mail you use for authentication in that mail setting "Less secure apps access" should be enabled
Sometimes we need do extra setting https://g.co/allowaccess allowed access from outside for a limited time and this solved my problem.
Default Subject
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.