• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • mailer-plugin
    • None

      When using Jenkins internally, it is sometimes needed to restrict sending e-mail notification external.

      There should be possible to add allowed domains in which to send e-mails to.

      When using Git as VCS the e-mail address of the committers is stored with the commit, and the mailer will the try to send to all users that might have broken the build.

      If you have cloned an open source project and regularly pulls updates from upstream the mailer might start sending mails to those upstream committers.

      That is not what you want from an internal Jenkins instance.

          [JENKINS-24318] Restrict which domains mail is sent to

          Daniel Beck added a comment -

          This just duplicates the linked issue.

          Daniel Beck added a comment - This just duplicates the linked issue.

          Harald Albers added a comment -

          It's about the same feature, but there are two distinct plugins involved, so we really need to issues here.

          Harald Albers added a comment - It's about the same feature, but there are two distinct plugins involved, so we really need to issues here.

          Daniel Beck added a comment -

          Sorry about that, the other issue's title is misleading.

          Daniel Beck added a comment - Sorry about that, the other issue's title is misleading.

          Mads Nielsen added a comment - - edited

          I'm very keen on implementing this.

          What would my best approach be? When looking through the code there is an @ExtenisonPoint called MailAddressFilter. The documentation suggest to implement that if you need to filter out emails sent by jenkins in a seperate plugin, but seeing as there has lately been a movement to limit the number of new plugins contributed, what would you think about me just adding a DomainFilter class to the existing mailer plugin, and provide a global configuration option where the user specifies which regex all outgoing mails must match?

          Is that the preferred solution? Or do i really need to create a seperate plugin for such a simple feature?

          Mads Nielsen added a comment - - edited I'm very keen on implementing this. What would my best approach be? When looking through the code there is an @ExtenisonPoint called MailAddressFilter. The documentation suggest to implement that if you need to filter out emails sent by jenkins in a seperate plugin, but seeing as there has lately been a movement to limit the number of new plugins contributed, what would you think about me just adding a DomainFilter class to the existing mailer plugin, and provide a global configuration option where the user specifies which regex all outgoing mails must match? Is that the preferred solution? Or do i really need to create a seperate plugin for such a simple feature?

          Daniel Beck added a comment -

          there has lately been a movement to limit the number of new plugins

          I'm not so sure about that. While there are often clarifying questions asked when hosting for a new plugin is requested, those are mostly about duplication of features.

          Daniel Beck added a comment - there has lately been a movement to limit the number of new plugins I'm not so sure about that. While there are often clarifying questions asked when hosting for a new plugin is requested, those are mostly about duplication of features.

          Per Arnold Blaasmo added a comment - - edited

          Actually there is an implementation in the email-ext plugin (https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin) that gives the possible functionality. It is called 'pre-send script'. I did some test with that and it works. Making a global pre-send script prevents all build jobs using the plugin send mail to given addresses.

          The problem was that I could not control whether or not the users enabled the email-ext-plugin in their build job.
          So I had to set up a filter on the smtp server that the build master uses.

          I found somewhere that it was plans to merge the mailer-plugin and the email-ext-plugin, but it does not seems to be a priority?

          Per Arnold Blaasmo added a comment - - edited Actually there is an implementation in the email-ext plugin ( https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin ) that gives the possible functionality. It is called 'pre-send script'. I did some test with that and it works. Making a global pre-send script prevents all build jobs using the plugin send mail to given addresses. The problem was that I could not control whether or not the users enabled the email-ext-plugin in their build job. So I had to set up a filter on the smtp server that the build master uses. I found somewhere that it was plans to merge the mailer-plugin and the email-ext-plugin, but it does not seems to be a priority?

          Alex Earl added a comment -

          There is no real plan to merge mailer and email-ext at this point.

          Alex Earl added a comment - There is no real plan to merge mailer and email-ext at this point.

            Unassigned Unassigned
            pablaasmo Per Arnold Blaasmo
            Votes:
            11 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: