Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69592

Enable setting email priority/importance with email-ext

      I use email-ext plugin to be able to manage notifications for many different jobs. I would like to be able to change email priority for important jobs, less priority for something simple like a failed unit test, so forth using the email-ext from within a pipeline.

      According to this stackoverflow this currently isn't possible but is easily implementable: https://stackoverflow.com/questions/7497955/jenkins-ci-how-to-add-importance-property-to-email-header

          [JENKINS-69592] Enable setting email priority/importance with email-ext

          Robin Fauvel added a comment -

          I managed to do it this way:

          node('My-Node') {
              stage('test') {
                  emailext(
                      body: 'Test content',
                      subject: 'Test subject',
                      to: 'example@test.com',
                      presendScript: '''msg.addHeader("X-Priority", "1")''')
              }
          }

          But it would be useful to have a global Jenkins parameter that allows you to choose with which priority all mails sent by Jenkins are sent.

          Robin Fauvel added a comment - I managed to do it this way: node( 'My-Node' ) { stage( 'test' ) { emailext(             body: 'Test content' ,             subject: 'Test subject' ,             to: 'example@test.com' ,             presendScript: '''msg.addHeader( "X-Priority" , "1" )' '') } } But it would be useful to have a global Jenkins parameter that allows you to choose with which priority all mails sent by Jenkins are sent.

          Alex Earl added a comment -

          You could add it in the global config under Default Pre-send Script. This would then work for all jobs.

          Alex Earl added a comment - You could add it in the global config under Default Pre-send Script. This would then work for all jobs.

            Unassigned Unassigned
            joelwizard Joel
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: