• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Critical Critical
    • email-ext-plugin
    • None
    • email-ext v 2.62

      Like the original motivation for introducing CC and BCC said, I'd like to notify some devs for each build failure independent of whether they are culprits or have committed or not; in order to make it clear for the recipients that these devs are "just watching" (and not have to take actions) I want to send them the email in CC.

      However, when they have also committed and they are in the list of TO recipients (in addition to the static CC or BCC recipients list), they are filtered out from TO recipients in hudson.plugins.emailext.EmailRecipientUtils#convertRecipientString(java.lang.String, hudson.EnvVars, int)

      Reproducer test case that fails now:

      @Test
      public void testSameRecipientInTOandCCandBCC_ShouldNotBeFilteredFromTOandCC()
              throws Exception {
          String recipientListString = "user@gmail.com, bcc:user@gmail.com, cc:user@gmail.com";
      
          Set<InternetAddress> toInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars);
      
          assertEquals(1, toInternetAddresses.size()); // ! Fails here with: "Actual: 0"
          assertTrue(toInternetAddresses.contains(new InternetAddress("user@gmail.com")));
      
          Set<InternetAddress> ccInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars, EmailRecipientUtils.CC);
      
          assertEquals(1, ccInternetAddresses.size());
          assertTrue(ccInternetAddresses.contains(new InternetAddress("user@gmail.com")));
      
          Set<InternetAddress> bccInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars, EmailRecipientUtils.BCC);
      
          assertEquals(1, bccInternetAddresses.size());
          assertTrue(bccInternetAddresses.contains(new InternetAddress("user@gmail.com")));
      }
      

          [JENKINS-52748] Same recipient in CC or BCC removes it from TO

          Reinhold Füreder created issue -
          Reinhold Füreder made changes -
          Description Original: Like the original motivation for introducing CC and BCC said, I'd like to notify some devs for each build failure independent of whether they are culprits or have committed or not; in order to make it clear for the recipients that these devs are "just watching" (and not have to take actions) I want to send them the email in CC.

          However, when they have also committed and they are in the list of TO recipients (in addition to the static CC or BCC recipients list), they are filtered out from TO recipients in {{hudson.plugins.emailext.EmailRecipientUtils#convertRecipientString(java.lang.String, hudson.EnvVars, int)}}

          Reproducer test case that fails now:
          {code:java}
          @Test
          public void testSameRecipientInTOandCCandBCC_ShouldNotBeFilteredFromTOandCC()
                  throws Exception {
              String recipientListString = "user@gmail.com, bcc:user@gmail.com, cc:user@gmail.com";

              Set<InternetAddress> toInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars);

              assertEquals(1, toInternetAddresses.size());
              assertTrue(toInternetAddresses.contains(new InternetAddress("user@gmail.com")));

              Set<InternetAddress> ccInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars, EmailRecipientUtils.CC);

              assertEquals(1, ccInternetAddresses.size());
              assertTrue(ccInternetAddresses.contains(new InternetAddress("user@gmail.com")));

              Set<InternetAddress> bccInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars, EmailRecipientUtils.BCC);

              assertEquals(1, bccInternetAddresses.size());
              assertTrue(bccInternetAddresses.contains(new InternetAddress("user@gmail.com")));
          }
          {code}
          New: Like the original motivation for introducing CC and BCC said, I'd like to notify some devs for each build failure independent of whether they are culprits or have committed or not; in order to make it clear for the recipients that these devs are "just watching" (and not have to take actions) I want to send them the email in CC.

          However, when they have also committed and they are in the list of TO recipients (in addition to the static CC or BCC recipients list), they are filtered out from TO recipients in {{hudson.plugins.emailext.EmailRecipientUtils#convertRecipientString(java.lang.String, hudson.EnvVars, int)}}

          Reproducer test case that fails now:
          {code:java}
          @Test
          public void testSameRecipientInTOandCCandBCC_ShouldNotBeFilteredFromTOandCC()
                  throws Exception {
              String recipientListString = "user@gmail.com, bcc:user@gmail.com, cc:user@gmail.com";

              Set<InternetAddress> toInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars);

              assertEquals(1, toInternetAddresses.size()); // ! Fails here with: "Actual: 0"
              assertTrue(toInternetAddresses.contains(new InternetAddress("user@gmail.com")));

              Set<InternetAddress> ccInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars, EmailRecipientUtils.CC);

              assertEquals(1, ccInternetAddresses.size());
              assertTrue(ccInternetAddresses.contains(new InternetAddress("user@gmail.com")));

              Set<InternetAddress> bccInternetAddresses = EmailRecipientUtils.convertRecipientString(recipientListString, envVars, EmailRecipientUtils.BCC);

              assertEquals(1, bccInternetAddresses.size());
              assertTrue(bccInternetAddresses.contains(new InternetAddress("user@gmail.com")));
          }
          {code}

          Adding link to PR

          Reinhold Füreder added a comment - Adding link to PR
          Reinhold Füreder made changes -
          Remote Link New: This issue links to "PR-170 (Web Link)" [ 21247 ]
          David van Laatum made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          David van Laatum made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]

            davidvanlaatum David van Laatum
            reinholdfuereder Reinhold Füreder
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: