Same recipient in CC or BCC removes it from TO

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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")));
      }
      

            Assignee:
            David van Laatum
            Reporter:
            Reinhold Füreder
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: