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

Incorrect mail address used for sending email notifications

    Details

    • Similar Issues:

      Description

      Incorrect email address is used for Git commits when sending email notifications, this can be seen in the console log for a failed build:

      Hudson Console:
      ---------------
      (...)
      Waiting for Hudson to finish collecting data
      ERROR: Illegal whitespace in address
      channel stopped
      ERROR: Illegal whitespace in address
      javax.mail.internet.AddressException: Illegal whitespace in address in string ``Geir Pettersen@comperio.no''

      Notice how the author's full name is used before the @ instead of the account name.
      By executing "git whatchanged" I can verify that the commit contains a correct email address in the author field:

      $ git whatchanged
      commit 53f56784f7299465e33f0cc483a397f23ea59fe5
      Author: Geir Gullestad Pettersen <ggp@comperio.no>
      Date: Mon Aug 9 02:03:35 2010 +0200

      hudson test...

      :100644 100644 5d2a1e7... fba468b... M src/main/java/no....

        Attachments

          Issue Links

            Activity

            gpettersen gpettersen created issue -
            Hide
            abayer Andrew Bayer added a comment -

            What version of the git plugin are you using?

            Show
            abayer Andrew Bayer added a comment - What version of the git plugin are you using?
            Hide
            abayer Andrew Bayer added a comment -

            Also, that email address may already have been defined for the user in Hudson - check the user's configuration. If there's already an email address defined for (using your git whatchanged example) "Geir Gullestad Pettersen", then the git plugin isn't going to try to create a new one - the existing one is used.

            Show
            abayer Andrew Bayer added a comment - Also, that email address may already have been defined for the user in Hudson - check the user's configuration. If there's already an email address defined for (using your git whatchanged example) "Geir Gullestad Pettersen", then the git plugin isn't going to try to create a new one - the existing one is used.
            Hide
            ncdc ncdc added a comment -

            I'm having the same problem. Using Hudson 1.371 and version 1.0.1 of the Git plugin. This is what I see in the Hudson job console output:

            Failed to send e-mail to Andy Goldstein because no e-mail address is known, and no default e-mail domain is configured

            Here is the output of "git whatchanged"

            commit 1d73cacddab106c23840834bfb29bfccfd0081e2
            Author: Andy Goldstein <[email address obscured, but it's my correct email address]>
            Date: Wed Aug 18 10:58:32 2010 -0400

            Show
            ncdc ncdc added a comment - I'm having the same problem. Using Hudson 1.371 and version 1.0.1 of the Git plugin. This is what I see in the Hudson job console output: Failed to send e-mail to Andy Goldstein because no e-mail address is known, and no default e-mail domain is configured Here is the output of "git whatchanged" commit 1d73cacddab106c23840834bfb29bfccfd0081e2 Author: Andy Goldstein < [email address obscured, but it's my correct email address] > Date: Wed Aug 18 10:58:32 2010 -0400
            Hide
            abayer Andrew Bayer added a comment -

            Have you checked what email address is set up for your user in Hudson?

            Show
            abayer Andrew Bayer added a comment - Have you checked what email address is set up for your user in Hudson?
            Hide
            ncdc ncdc added a comment -

            I haven't configured authentication/users in Hudson. I was hoping it would just pick up the author (or committer) address from the Git commit. Can it not do that?

            Show
            ncdc ncdc added a comment - I haven't configured authentication/users in Hudson. I was hoping it would just pick up the author (or committer) address from the Git commit. Can it not do that?
            Hide
            abayer Andrew Bayer added a comment -

            It should - I'll try to reproduce this locally and see what I can figure out.

            Show
            abayer Andrew Bayer added a comment - It should - I'll try to reproduce this locally and see what I can figure out.
            Hide
            ncdc ncdc added a comment - - edited

            Thanks, I look forward to hearing back what you discover. If it makes any difference, the "people" in Hudson were added to the system when I had version 0.9.2 of the Git plugin installed. Maybe that version had issues with figuring out the email address? I clicked on the People link in Hudson, clicked on my user, then on Configure, and my email address is currently blank.

            Show
            ncdc ncdc added a comment - - edited Thanks, I look forward to hearing back what you discover. If it makes any difference, the "people" in Hudson were added to the system when I had version 0.9.2 of the Git plugin installed. Maybe that version had issues with figuring out the email address? I clicked on the People link in Hudson, clicked on my user, then on Configure, and my email address is currently blank.
            Hide
            abayer Andrew Bayer added a comment -

            Ah-ha - I don't know for sure whether the user (i.e., the "people" entry) email address was borked in 0.9.2, but if the user already exists, it does tend to have problems setting the email address automatically from the git changelog. So you can fix this as a one-off by entering an email address for your user, but I'll keep trying to figure out what's really going wrong.

            Show
            abayer Andrew Bayer added a comment - Ah-ha - I don't know for sure whether the user (i.e., the "people" entry) email address was borked in 0.9.2, but if the user already exists, it does tend to have problems setting the email address automatically from the git changelog. So you can fix this as a one-off by entering an email address for your user, but I'll keep trying to figure out what's really going wrong.
            Hide
            aeolus1982 aeolus1982 added a comment -

            hello guys, wonder if we have got any status update on this issue. we probably ran into same problem on our hudson server (hudson 1.374 git 1.0.1), it reports fail to send email to address which is basically appending user name with @domain instead of using the git user email filed from the git change log.

            cheers.

            Show
            aeolus1982 aeolus1982 added a comment - hello guys, wonder if we have got any status update on this issue. we probably ran into same problem on our hudson server (hudson 1.374 git 1.0.1), it reports fail to send email to address which is basically appending user name with @domain instead of using the git user email filed from the git change log. cheers.
            Hide
            aeolus1982 aeolus1982 added a comment -

            hello people,

            I guess i found the problem here, here is the git log output from my host:

            commit cf566f1b17ff280c4bda9af4da7547110cf1fe0c
            Author: Andrew Bayer <abayer@digg.com>
            Date: Fri Sep 17 11:10:26 2010 -0700

            it seems to be different from the one expected in the source code, which is
            author xxx xxx <xxx@bbb.com> 1231213131 -12121

            Show
            aeolus1982 aeolus1982 added a comment - hello people, I guess i found the problem here, here is the git log output from my host: commit cf566f1b17ff280c4bda9af4da7547110cf1fe0c Author: Andrew Bayer <abayer@digg.com> Date: Fri Sep 17 11:10:26 2010 -0700 it seems to be different from the one expected in the source code, which is author xxx xxx <xxx@bbb.com> 1231213131 -12121
            Hide
            stigkj Stig Kleppe-Jørgensen added a comment -

            Actually, the plugin is running this command to get the change log:

            git whatchanged --no-abbrev -M --pretty=raw

            which matches the regexp-es.

            Show
            stigkj Stig Kleppe-Jørgensen added a comment - Actually, the plugin is running this command to get the change log: git whatchanged --no-abbrev -M --pretty=raw which matches the regexp-es.
            Hide
            mohamedmansour mohamedmansour added a comment -

            I see this as well, are there any tips on how we can debug this? If I could debug it, perhaps I could submit a patch to fix it.

            Show
            mohamedmansour mohamedmansour added a comment - I see this as well, are there any tips on how we can debug this? If I could debug it, perhaps I could submit a patch to fix it.
            Hide
            rogerhu rogerhu added a comment -

            I think I've managed to figure out the issue:

            http://hustoknow.blogspot.com/2011/01/hudson-git-plug-in-issues.html

            Changing the code to this part in GitChangeSet.java worked:

            if (fixEmpty(csAuthorEmail) != null ) {
            try

            { user.addProperty(new Mailer.UserProperty(csAuthorEmail)); // addProperty() will overwrite the existing property }

            catch(IOException e)

            { // ignore error }

            }

            The issue appears to be that when User() is first initialized, all the UserProperties are also init. For Git committers that don't have explicit accounts, this Mailer.UserProperty() is set to null, causing the e-mail address not to be set.

            The fix above makes the Git commit message the highest priority for resolving e-mail addresses. Using both the getProperty() check, or the getProperty() and getAddressInfo() causes problems as described in the blog entry.

            Show
            rogerhu rogerhu added a comment - I think I've managed to figure out the issue: http://hustoknow.blogspot.com/2011/01/hudson-git-plug-in-issues.html Changing the code to this part in GitChangeSet.java worked: if (fixEmpty(csAuthorEmail) != null ) { try { user.addProperty(new Mailer.UserProperty(csAuthorEmail)); // addProperty() will overwrite the existing property } catch(IOException e) { // ignore error } } The issue appears to be that when User() is first initialized, all the UserProperties are also init. For Git committers that don't have explicit accounts, this Mailer.UserProperty() is set to null, causing the e-mail address not to be set. The fix above makes the Git commit message the highest priority for resolving e-mail addresses. Using both the getProperty() check, or the getProperty() and getAddressInfo() causes problems as described in the blog entry.
            Hide
            mambu Marco Ambu added a comment -

            I reported the same problem on the dev mailing list because also the ci.jenkins-ci.org installation has the same problem.
            I was wondering if it is possible to retrive the e-mail address (if configured) from github?

            this is my git configuration where I explicitely set my email address:

            $ git config -l
            github.user=mambu
            user.name=Marco Ambu
            user.email=MYEMAIL@gmail.com
            
            Show
            mambu Marco Ambu added a comment - I reported the same problem on the dev mailing list because also the ci.jenkins-ci.org installation has the same problem. I was wondering if it is possible to retrive the e-mail address (if configured) from github? this is my git configuration where I explicitely set my email address: $ git config -l github.user=mambu user.name=Marco Ambu user.email=MYEMAIL@gmail.com
            Hide
            ge0ffrey Geoffrey De Smet added a comment -

            Bug still exists on Hudson ver. 1.391 (private-01/13/2011 16:10-vjuranek).

            Show
            ge0ffrey Geoffrey De Smet added a comment - Bug still exists on Hudson ver. 1.391 (private-01/13/2011 16:10-vjuranek).
            Hide
            ge0ffrey Geoffrey De Smet added a comment -

            abayer accepted my pull request with the changes proposed by rogerhu
            https://github.com/jenkinsci/git-plugin/commit/8364a5bf6c26c9901e3ffbc19f9aa7bda4bd65a4

            I presume this issue is now fixed.

            Show
            ge0ffrey Geoffrey De Smet added a comment - abayer accepted my pull request with the changes proposed by rogerhu https://github.com/jenkinsci/git-plugin/commit/8364a5bf6c26c9901e3ffbc19f9aa7bda4bd65a4 I presume this issue is now fixed.
            Hide
            david_beutel J. David Beutel added a comment -

            Maybe not. I just tried this snapshot from the trunk, and while it stopped sending email to the full name, it seems to be resolving the addresses to nothing now. The author lines in changelog.xml are in the proper format with full name, email, timestamp, and TZ. The user/Full Name/configure page also has the email address somehow, so even if that's overriding, it doesn't explain why the recipient list is empty.

            Tests FAILED - view reports in target/test-reports
            Application context shutting down...
            Application context shutdown.
            Recording test results
            An attempt to send an e-mail to empty list of recipients, ignored.

            Show
            david_beutel J. David Beutel added a comment - Maybe not. I just tried this snapshot from the trunk, and while it stopped sending email to the full name, it seems to be resolving the addresses to nothing now. The author lines in changelog.xml are in the proper format with full name, email, timestamp, and TZ. The user/Full Name/configure page also has the email address somehow, so even if that's overriding, it doesn't explain why the recipient list is empty. Tests FAILED - view reports in target/test-reports Application context shutting down... Application context shutdown. Recording test results An attempt to send an e-mail to empty list of recipients, ignored.
            Hide
            david_beutel J. David Beutel added a comment - - edited

            Never mind. It worked after I actually checked "Send separate e-mails to individuals who broke the build". Sorry.

            Show
            david_beutel J. David Beutel added a comment - - edited Never mind. It worked after I actually checked "Send separate e-mails to individuals who broke the build". Sorry.
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            slide_o_mix Alex Earl added a comment -

            There is still an issue with this where the git plugin somehow overrides the mailing address if there are git-svn repos. See JENKINS-13715

            Show
            slide_o_mix Alex Earl added a comment - There is still an issue with this where the git plugin somehow overrides the mailing address if there are git-svn repos. See JENKINS-13715
            slide_o_mix Alex Earl made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            slide_o_mix Alex Earl made changes -
            Link This issue is duplicated by JENKINS-13715 [ JENKINS-13715 ]
            Hide
            ndeloof Nicolas De Loof added a comment -

            git plugin now only set email address if not already set for User

            Show
            ndeloof Nicolas De Loof added a comment - git plugin now only set email address if not already set for User
            ndeloof Nicolas De Loof made changes -
            Status Reopened [ 4 ] Resolved [ 5 ]
            Assignee abayer [ abayer ] Nicolas De Loof [ ndeloof ]
            Resolution Fixed [ 1 ]
            markewaite Mark Waite made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 137254 ] JNJira + In-Review [ 204440 ]

              People

              • Assignee:
                ndeloof Nicolas De Loof
                Reporter:
                gpettersen gpettersen
              • Votes:
                17 Vote for this issue
                Watchers:
                18 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: