jenkins do not send emails to multiple recipients

前端 未结 5 2077
南笙
南笙 2021-02-19 15:39

I use Jenkins email-ext plugin to send emails when a build starts. When I specified only one recipient of such emails, everything worked smoothly - I got emails.

But wh

5条回答
  •  失恋的感觉
    2021-02-19 16:19

    I was also wondering why when one email was given it worked and when multiple email addresses were given separated by commas ',' it didn't. Managed to make it work.

    This is what worked for me

    pipeline {
            agent any
    
            environment {
                EMAIL_INFORM = 'abc@gmail.com;def@gmail.com'
            }
    
    
            stages {
            }
    
            post {
    
                success {  
                    emailext body: 'Check console output at $BUILD_URL to view the results.', 
                            to: "${EMAIL_INFORM}", 
                            subject: 'Jenkins - Released $PROJECT_NAME - #$BUILD_NUMBER'
                }
    
            }
        }
    

    You should use semi colons ';' rather than commas ',' when invoking "emailext" via declarative syntax in pipeline.

    Hopefully it works now.

提交回复
热议问题