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

Same recipient in CC or BCC removes it from TO

XMLWordPrintable

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

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

              Created:
              Updated:
              Resolved: