Jenkins "Not sending mail to unregistered user"

Viewed 17135

Jenkins refuses to send error mails to some users. In the log I found these messages:

....
Build step 'Maven Goals aufrufen' marked build as failure
Not sending mail to unregistered user user1@example.org
Sending e-mails to: user2@example.org
Finished: FAILURE

The user (user1) is listed in the admin people list. He also has an registered email (user1@example.org).

Jenkins Peoaple admin interface

So why is this user called an unregistered user?

When searching for this warning, I find several open JIRA issues such as https://issues.jenkins-ci.org/browse/JENKINS-43178 But these doesn't help me.

Is this a misconfiguration or a jenkins bug?

5 Answers

There's Allow sending to unregistered users setting under Configure System menu at least in Jenkins >= 2.150.1.

From the OP it's not clear if they use LDAP, but here is some information that solved it for me and that I haven't found anywhere, including the Jenkins JIRA.

The following suggestion:

-Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true

as well as:

Allow sending to unregistered users

and:

Create committer as Jenkins user

did not work for me. The first answer did put me on the track to a solution, though. It turns out that when using LDAP, Jenkins actually matches against the user name of the git committer. So if the git commit message is:

Committer: John Doe <John.Doe@company.com>  2019-05-27 19:12:00

Jenkins will take "John Doe", convert it to "john.doe" and try to match against LDAP. Now, if your LDAP user name is "john.doe" you're good, but in my case the company standard is "doejohn", which will lead to the dreaded message:

Not sending mail to unregistered user John.Doe@company.com

This message is very misleading since it shows the correct e-mail address instead of mentioning the invented (non-existing) user name. The solution for me was to configure the git user name to "doejohn":

$ git config --global user.name "doejohn"
Related