Repository navigation
[JENKINS-16332] Leading and trailing underscores are added to commiters email address, unable to send build notification #13210
Description
Jenkins email-ext plugin fails to send email, the error is
Failed to create e-mail address for _developer1@xxx.net_
Failed to create e-mail address for _developer2@xxx.net_
Failed to create e-mail address for _developer1@xxx.net_
Failed to create e-mail address for _developer1@xxx.net_
(Names and domain are changed)
Jan 13, 2013 7:15:56 PM hudson.plugins.emailext.ExtendedEmailPublisher addAddressesFromRecipientList
WARNING: Could not create email address.
javax.mail.internet.AddressException: Domain contains illegal character in string ``_developer1@xxx.net_''
at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1269)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:1091)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:633)
at javax.mail.internet.InternetAddress.(InternetAddress.java:111)
at hudson.plugins.emailext.EmailRecipientUtils.convertRecipientString(EmailRecipientUtils.java:60)
at hudson.plugins.emailext.ExtendedEmailPublisher.addAddressesFromRecipientList(ExtendedEmailPublisher.java:687)
at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:508)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:297)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:289)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:249)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
at hudson.model.AbstractBuild$AbstractBuildExecution.perJan 13, 2013 7:15:56 PM hudson.plugins.emailext.ExtendedEmailPublisher addAddressesFromRecipientList
WARNING: Could not create email address.
javax.mail.internet.AddressException: Domain contains illegal character in string ``_developer1@xxx.net_''
at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1269)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:1091)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:633)
at javax.mail.internet.InternetAddress.(InternetAddress.java:111)
at hudson.plugins.emailext.EmailRecipientUtils.convertRecipientString(EmailRecipientUtils.java:60)
at hudson.plugins.emailext.ExtendedEmailPublisher.addAddressesFromRecipientList(ExtendedEmailPublisher.java:687)
at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:508)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:297)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:289)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:249)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:192)
at hudson.model.Run.execute(Run.java:1587)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)formAllBuildSteps(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:192)
at hudson.model.Run.execute(Run.java:1587)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
First I thought is the problem is in email-ext plugin, but when I went to "Changes" tab and opened the page
http://host/jenkins/user/Developer%201%20__developer1@xxx.net_/
(hostname changed)
it showed
Jenkins User Id: Developer 1 _developer1@xxx.net_
For unknown reason Jenkins adds a leading and trailing underscore to email address
Environment
Jenkins ver. 1.498
Jenkins Mercurial plugin 1.42
Jenkins Email Extension Plugin 2.25
Mercurial Distributed SCM (version 1.4.3)
Ubuntu 10.04.4 LTS
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
We have a build cluster with a master and two slaves, this problem happened on the slave machine.
When I type hg log on Jenkins job's workspace, then all changesets have
correct email address without underscores, so it is not Mercurial configuration problem.
Originally reported by
sgr, imported from: Leading and trailing underscores are added to commiters email address, unable to send build notification
- assignee:
jglick
- status: Resolved
- priority: Major
- component(s): core
- label(s): 1.532.3-rejected, user
- resolution: Fixed
- resolved: 2014-02-24T00:10:13+00:00
- votes: 6
- watchers: 20
- imported: 2025-11-24
Raw content of original issue
Jenkins email-ext plugin fails to send email, the error is
Failed to create e-mail address for _developer1@xxx.net_ Failed to create e-mail address for _developer2@xxx.net_ Failed to create e-mail address for _developer1@xxx.net_ Failed to create e-mail address for _developer1@xxx.net_
(Names and domain are changed)
Jan 13, 2013 7:15:56 PM hudson.plugins.emailext.ExtendedEmailPublisher addAddressesFromRecipientList WARNING: Could not create email address. javax.mail.internet.AddressException: Domain contains illegal character in string ``_developer1@xxx.net_'' at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1269) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:1091) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:633) at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:111) at hudson.plugins.emailext.EmailRecipientUtils.convertRecipientString(EmailRecipientUtils.java:60) at hudson.plugins.emailext.ExtendedEmailPublisher.addAddressesFromRecipientList(ExtendedEmailPublisher.java:687) at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:508) at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:297) at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:289) at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:249) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810) at hudson.model.AbstractBuild$AbstractBuildExecution.perJan 13, 2013 7:15:56 PM hudson.plugins.emailext.ExtendedEmailPublisher addAddressesFromRecipientList WARNING: Could not create email address. javax.mail.internet.AddressException: Domain contains illegal character in string ``_developer1@xxx.net_'' at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1269) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:1091) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:633) at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:111) at hudson.plugins.emailext.EmailRecipientUtils.convertRecipientString(EmailRecipientUtils.java:60) at hudson.plugins.emailext.ExtendedEmailPublisher.addAddressesFromRecipientList(ExtendedEmailPublisher.java:687) at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:508) at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:297) at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:289) at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:249) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785) at hudson.model.Build$BuildExecution.cleanUp(Build.java:192) at hudson.model.Run.execute(Run.java:1587) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236)formAllBuildSteps(AbstractBuild.java:785) at hudson.model.Build$BuildExecution.cleanUp(Build.java:192) at hudson.model.Run.execute(Run.java:1587) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236)
First I thought is the problem is in email-ext plugin, but when I went to "Changes" tab and opened the page
http://host/jenkins/user/Developer%201%20__developer1@xxx.net_/ (hostname changed)
it showed
Jenkins User Id: Developer 1 _developer1@xxx.net_
For unknown reason Jenkins adds a leading and trailing underscore to email address
Environment Jenkins ver. 1.498 Jenkins Mercurial plugin 1.42 Jenkins Email Extension Plugin 2.25 Mercurial Distributed SCM (version 1.4.3) Ubuntu 10.04.4 LTS Java(TM) SE Runtime Environment (build 1.6.0_32-b05) Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
We have a build cluster with a master and two slaves, this problem happened on the slave machine.
When I type hg log on Jenkins job's workspace, then all changesets have correct email address without underscores, so it is not Mercurial configuration problem.
Activity
jenkins-infra-bot commentedon Jan 14, 2013
Raw content of original comment:
The user ID will typically include underscores, but there ought to be a separate email property (shown at /user/*/configure) that includes the original email address. Perhaps this got broken by the recent split of the mailer plugin out of core; definitely assigning of emails to users who sign themselves up in the web UI was broken (fix will be in 1.500), but user creation from SCM changelogs is a different code path. Need to check if it is reproducible.
jenkins-infra-bot commentedon Jan 14, 2013
Raw content of original comment:
In my case the commiters don't sign up themselves, they don't have Jenkins accounts and cannot login into Jenkins. Emails are extracted from SCM log only.
jenkins-infra-bot commentedon Jan 15, 2013
Raw content of original comment:
The problem has gone after 'sudo service jenkins restart'.
jenkins-infra-bot commentedon Jan 15, 2013
Raw content of original comment:
Hmm if even @sgr cannot reproduce after restarting Jenkins then it is unlikely I will be able to reproduce either.
jenkins-infra-bot commentedon Jan 15, 2013
Raw content of original comment:
Cannot reproduce
jenkins-infra-bot commentedon Mar 1, 2013
pykler2:
Raw content of original comment:
Try setting up a repo with your username = First MyName
then make a commit that fails the build, or triggers the email and look at the console log ... it will clearly have underscores instead of <> ... also check the details log as mentioned ... the issue should be visible. We hit this as soon as we upgraded to the lates jenkins.
jenkins-infra-bot commentedon Mar 1, 2013
Raw content of original comment:
Still cannot reproduce. Using 1.505-SNAPSHOT (Mailer Plugin 1.4 was bundled) and dev version of Mercurial plugin, created a Maven job based on a new Hg repo created from a quickstart archetype, built it. Committed a test failure where my ~/.hgrc has
and checked changelog. http://localhost:8080/user/Jesse%20Glick%20_jglick@netbeans.org_/configure now has Your name set to Jesse Glick and E-mail address set to jglick@netbeans.org, as expected.
(Again it is normal for http://localhost:8080/user/Jesse%20Glick%20_jglick@netbeans.org_/ to show Jesse Glick as the display name followed by Jenkins User Id: Jesse Glick jglick@netbeans.org since IDs are always escaped to not contain dangerous characters such as <, but this should not affect mail delivery or other functions since the email address is stored as a user property.)
Also installed email-ext plugin, added an Unstable trigger to send to committers, committed another test failure and built again. Log showed
as expected (I did not configure SMTP so did not check that it really sent mail).
If you can still reproduce an issue with the latest versions of the Mercurial plugin, Jenkins core, and the Mailer plugin (now responsible for email address maintenance in a User), feel free to debug and file a pull request with a fix.
jenkins-infra-bot commentedon Mar 3, 2013
Raw content of original comment:
After upgrading Jenkins to version 1500 the issue has gone.
jenkins-infra-bot commentedon Apr 19, 2013
gzilla:
Raw content of original comment:
I hope it's ok to reopen this, because I'm also seeing the same issue and have not seen it go away across jenkins upgrades. I'm currently running version 1.511-1.1 on a RHEL 5 system, using the officially supplied rpm. I also he emailext plugin, in case that has anything to do with this. There are not full user accounts that were explicitly registered with passwords. These are all auto-created users from the mercurial SCM change sets.
My main concern with this bug is that submitters are no longer receiving email notifications when the build fails.
jenkins-infra-bot commentedon Apr 19, 2013
Raw content of original comment:
This issue happen again 1 week ago on the latest version of Jenkins.
jenkins-infra-bot commentedon Apr 20, 2013
Raw content of original comment:
Another incident happened in Jenkins 1.511. The build was triggered by an SCM change (Mercurial), culrprits have received emails, but the commiter didn't recieve the email because Jenkins appended leading and trailing underscores to his email address
jenkins-infra-bot commentedon Apr 25, 2013
Raw content of original comment:
You can reopen whatever you like, but until someone who is able to reproduce the bug goes through it with a debugger, nothing is going to happen.
By the way I no longer use Mercurial and barely maintain this plugin. If there is someone who does use Mercurial full-time and is proficient at Jenkins plugin development, please consider taking it over.
jenkins-infra-bot commentedon May 3, 2013
Raw content of original comment:
The body of the email sent by ext-email contains invalid emails.
However, the Mercurial changeset has a correct email
jenkins-infra-bot commentedon May 4, 2013
Raw content of original comment:
I have run a script in Jenkins console
it prints
So the user object for which Jenkins uses a wrong email, has a different value for email than normal users, see hudson.tasks.Mailer.UserProperty#getAddress.
For normal users getAddress returns email, while for John Doe not email, but user's id is returned.
jenkins-infra-bot commentedon May 4, 2013
Raw content of original comment:
I don't think that this bug is mercurial-specific, the script shows that the problem is that Jenkins cannot detect a user's email by user's id, even though the email is the part of the id.
59 remaining items
jenkins-infra-bot commentedon Feb 24, 2014
Raw content of original comment:
Integrated in
jenkins_main_trunk #3192
[FIXED JENKINS-16332] Ensure that User records are saved when the fullName is not recoverable from the id. (Revision fdda9ca)
Result = SUCCESS
Jesse Glick : fdda9ca65689423794a8378c1f28faca7dffddf0
Files :
jenkins-infra-bot commentedon Feb 25, 2014
Raw content of original comment:
Jesse,
Will this fix jobs where malformed culprits were being copied from earlier builds, or do we need to manually "flush" the job history somehow?
jenkins-infra-bot commentedon Feb 25, 2014
Raw content of original comment:
This fix will not handle all cases involving historical records. If a new build is run after upgrade whose changelog mentions the given committer’s full name, that name will be properly registered and you should not see the problem for that user again. The main problem I can foresee is a build which was failing at the time of upgrade, and continues to fail without new changes being committed (to that or other jobs developed by the same people), and is using an email trigger configured to repeatedly send mail for every unstable build.
Again there are no “malformed” culprits fields here. The culprits list is correct; the problem only arises when the culprits list contains the only record of a given user in the system. You ought to be able to work around the problem for a given user by visiting that user’s page as hyperlinked from a changelog (logged in as an administrator), and explicitly setting a full name (and/or email address).
jenkins-infra-bot commentedon Feb 25, 2014
Raw content of original comment:
I see. So just to make sure I understand correctly:
Until a user makes a new commit, any existing jobs will keep on using the incorrect email address. Once a user makes a new commit, his email address will get corrected system-wide across all jobs. Alternatively, deleting the contents of the "builds" directory will remove all changelogs and force re-evaluation of the email address.
Is that correct?
jenkins-infra-bot commentedon Feb 25, 2014
Raw content of original comment:
Right. You can simply look in $JENKINS_HOME/users/ to see whether the user has been defined or not.
No. If you deleted all historical builds, then either the next build has commits from the relevant user(s), in which case their email addresses will be recorded; or it does not, in which case the culprits list for that build will simply be empty and no email will be sent (unless you have an unconditional recipient configured in the job). In the former case, deleting the old build records does not improve your situation at all. In the latter case, deleting them could make the new build’s status be “unstable” due to test failures or whatever, rather than “failed” due to an attempt to send mail to bogus addresses, but the email addresses of users mentioned in those old builds would still be missing.
jenkins-infra-bot commentedon Apr 7, 2014
Raw content of original comment:
Fixed in 1.554. No need to backport.
jenkins-infra-bot commentedon Nov 24, 2025
[Original
is_duplicated_byfrom Jira: JENKINS-15253]