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

email-ext : email addresses with dash are truncated

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • email-ext-plugin
    • Red Hat Enterprise Linux Server release 7.8 (Maipo) 64b
      OpenJDK 1.8.0_252-b09
      Jenkins 2.222.3
      email-ext plugin 2.69

      When a developer email address contains a dash (ex: compound name), the email address part between dash and @ is truncated. Then, the developer did not receive mail.

      Example: john.doe-die@domain.com is truncated to john.doe@domain.com

      We are calling plugin from a declarative pipeline with this code: 

      post {
        emailext recipientProviders: [
            [$class: 'RequesterRecipientProvider'],
            [$class: 'DevelopersRecipientProvider']
          ],
          subject: '$DEFAULT_SUBJECT',
          body: '$DEFAULT_CONTENT',
          attachLog: true,
          compressLog: true
      }

       

       

          [JENKINS-62832] email-ext : email addresses with dash are truncated

          Alex Earl added a comment -

          I'm not able to reproduce this in tests. Can you enable debug mode in the global config for email-ext and then provide a build log?

          Alex Earl added a comment - I'm not able to reproduce this in tests. Can you enable debug mode in the global config for email-ext and then provide a build log?

          Joël Royer added a comment - - edited

          I will do it soon and I will be back with a build log.

          I've just add to the description the code we use in our pipeline.

          Joël Royer added a comment - - edited I will do it soon and I will be back with a build log. I've just add to the description the code we use in our pipeline.

          Joël Royer added a comment -

          Here is the log:

          [Pipeline] emailext
          messageContentType = text/html; charset=UTF-8
          Request made to attach build log
          Request made to compress build log
          Adding recipients from project recipient list
            Collecting change authors...
              build: 2
                adding author: DOE John
          Adding DOE John with address john.doe@domain.com
          Analyzing: john.doe@domain.com
          Looking for: john.doe@domain.com
          	starting at: 0
          	firstFoundIdx: 0
          	firstFoundIdx-substring: john.doe@domain.com
          	=> found type: 0
          Analyzing: john.doe@domain.com
          Looking for: john.doe@domain.com
          	starting at: 0
          	firstFoundIdx: 0
          	firstFoundIdx-substring: john.doe@domain.com
          	=> found type: 0
          Analyzing: john.doe@domain.com
          Looking for: john.doe@domain.com
          	starting at: 0
          	firstFoundIdx: 0
          	firstFoundIdx-substring: john.doe@domain.com
          	=> found type: 0
          Adding recipients from trigger recipient list
          Successfully created MimeMessage

          Joël Royer added a comment - Here is the log: [Pipeline] emailext messageContentType = text/html; charset=UTF-8 Request made to attach build log Request made to compress build log Adding recipients from project recipient list Collecting change authors... build: 2 adding author: DOE John Adding DOE John with address john.doe@domain.com Analyzing: john.doe@domain.com Looking for: john.doe@domain.com starting at: 0 firstFoundIdx: 0 firstFoundIdx-substring: john.doe@domain.com => found type: 0 Analyzing: john.doe@domain.com Looking for: john.doe@domain.com starting at: 0 firstFoundIdx: 0 firstFoundIdx-substring: john.doe@domain.com => found type: 0 Analyzing: john.doe@domain.com Looking for: john.doe@domain.com starting at: 0 firstFoundIdx: 0 firstFoundIdx-substring: john.doe@domain.com => found type: 0 Adding recipients from trigger recipient list Successfully created MimeMessage

          Joël Royer added a comment - - edited

          For information, we use an active directory for authentification.

          If the email address is read from AD, can you tell me which field is used?

          Joël Royer added a comment - - edited For information, we use an active directory for authentification. If the email address is read from AD, can you tell me which field is used?

          Alex Earl added a comment -

          email-ext uses the Mailer.Userproperty class to get the configured email for the user (https://github.com/jenkinsci/email-ext-plugin/blob/960cb17bbca6f6261cba407ac92842296a9a1be6/src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java#L109), these users can be created by the SCM when requested to get the list of changes. The Mailer.Userproperty will use a MailAddressResolver internally to get the email address for the user. There are various different implementations of MailAddressResolver (one of which is in the Active Directory plugin), but the first one that responds will be the email address that is used. Is this happening for all users, or for one user? What plugins do you have installed?

          Alex Earl added a comment - email-ext uses the Mailer.Userproperty class to get the configured email for the user ( https://github.com/jenkinsci/email-ext-plugin/blob/960cb17bbca6f6261cba407ac92842296a9a1be6/src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java#L109 ), these users can be created by the SCM when requested to get the list of changes. The Mailer.Userproperty will use a MailAddressResolver internally to get the email address for the user. There are various different implementations of MailAddressResolver (one of which is in the Active Directory plugin), but the first one that responds will be the email address that is used. Is this happening for all users, or for one user? What plugins do you have installed?

          Joël Royer added a comment -

          It happens with only one user.

          The plugin for active directory is active-directory 2.16 (https://plugins.jenkins.io/active-directory/).

           

          Joël Royer added a comment - It happens with only one user. The plugin for active directory is active-directory 2.16 ( https://plugins.jenkins.io/active-directory/ ).  

          Joël Royer added a comment -

          I've check user account in AD.

          His email address is well john.doe-die@domain.com but it is not set in an "mail" field. Could it be the reason ?

          Joël Royer added a comment - I've check user account in AD. His email address is well john.doe-die@domain.com  but it is not set in an "mail" field. Could it be the reason ?

          Alex Earl added a comment -

          If the user property is not set for that user, then the MailAddressResolver stuff will come into play and some MailAddressResolvers will just append the username they see from the commit with the domain name and return. If you set it in the email field for that user, that value will be used directly.

          Alex Earl added a comment - If the user property is not set for that user, then the MailAddressResolver stuff will come into play and some MailAddressResolvers will just append the username they see from the commit with the domain name and return. If you set it in the email field for that user, that value will be used directly.

          Joël Royer added a comment - - edited

          I've got news.

          The email-ext plugin is not the cause. We have a cache problem in the "People" section of Jenkins.

          Sorry for false alert.

          Joël Royer added a comment - - edited I've got news. The email-ext plugin is not the cause. We have a cache problem in the "People" section of Jenkins. Sorry for false alert.

            slide_o_mix Alex Earl
            jroyer Joël Royer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: