jenkins do not send emails to multiple recipients

前端 未结 5 2073
南笙
南笙 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 15:56

    Downgrade the Email-ext plugin to 2.25

    Here is the link http://mirrors.jenkins-ci.org/plugins/email-ext/2.25/

    This worked for me. Hope it helps! Thanks :)

    0 讨论(0)
  • 2021-02-19 15:57

    what worked for me was giving a comma and space between email addresses, such as:

    x1@jenkins.com, x2@jenkins.com, x3@jenkins.com
    

    XML representation of the Jenkins job looks as:

    <maven2-moduleset plugin="maven-plugin@2.6">
    ...
     <reporters>
      <hudson.maven.reporters.MavenMailer>
       <recipients>x1@jenkins.com, x2@jenkins.com, x3@jenkins.com</recipients>
       <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
       <sendToIndividuals>true</sendToIndividuals>
       <perModuleEmail>true</perModuleEmail>
      </hudson.maven.reporters.MavenMailer>
     </reporters>
    </maven2-moduleset>
    

    It has been sending mails all good with this.

    0 讨论(0)
  • 2021-02-19 16:15

    Make sure you select the option in the project configuration for email-ext to send an email for each child and not just the parent and then it should work.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-19 16:21

    Just in case anyone else is having a similar problem, in my case I could not get it to send to multiple email addresses with dots in them. It turns out though, that there were some fields in the "Advanced settings" for the plugin that was causing issues.

    Namely, that I did not have any triggers that would send to the recipient list. So make sure you have at least one trigger that will send to the recipient list if you want those emails sent out otherwise you will get an warning about trying to send to an empty list and no emails sent.

    0 讨论(0)
提交回复
热议问题