Jenkins "Do not send mail to unregistered user"

Jenkins refuses to send error messages 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 

User (user1) is listed in the list of administrators. He also has an email registered ( user1@example.org ).

Jenkins Peoaple Admin Interface

So why did this user call an unregistered user?

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

Is this the wrong configuration or jenkins error?

+13
source share
5 answers

An unregistered user did not have a jenkins password. After entering the password in the jenkins user password field, mail will be sent to this user.

To enter a password

User password

+3
source

The problem was (for me):

  SECURITY-372 (advisory) Emails were sent to addresses not associated with actual users of Jenkins. 

I use Jenkins with a Gerrit trigger for newly created patch sets or published drafts. With this security patch, Jenkins will try to "guess" the username by name before the email address. For example, in the First Name Last Name section, the First Name last name will be the username that jenkins is trying to find in the Jenkins user database, but this combination does not match the identifier used in our LDAP, and thus jenkins does not will send emails. no ... if:

https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin#Email-extplugin-2.57.2(April10,2017)

 If the security fix is undesirable in a particular instance, it can be disabled with either or both of the following two system properties: -Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true: send mail to build culprits even if they do not seem to be associated with a valid Jenkins login. -Dhudson.tasks.MailSender.SEND_TO_USERS_WITHOUT_READ=true: send mail to build culprits associated with a valid Jenkins login even if they would not otherwise have read access to the job. 

These JAVA_ARGS can be added to / etc / default / jenkins or / etc / sysconfig / jenkins, depending on your distribution.

+7
source

There Allow sending to unregistered users settings in the Configure System menu at least in Jenkins 2.150.1.

+5
source

To clarify Matthias answer: Even if a user account is created during the build (because SCM provides information about committers), it still remains an unregistered Jenkins user. Thus, no emails will be sent to this user.

If you go to the corresponding user account at <your-jenkins-URL>/asynchPeople/ , you can configure this account and enter a password for it. Theoretically, a user can log in to Jenkins using this password now. And once the Jenkins user account has an associated password, it is no longer considered "unregistered." And they will receive email notifications. Voila.

+3
source

Itโ€™s not clear from the OP whether they use LDAP, but here is some information that solved this for me that I havenโ€™t found anywhere, including Jenkins JIRA.

Next suggestion:

-Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS = true

as well as:

Allow sending to unregistered users

and:

Create a committer as a Jenkins user

didn't work for me. However, the first answer put me on a way to solve the problem. It turns out that when using LDAP, Jenkins actually maps to the git committer username. So if the message is git commit:

 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 with LDAP. Now, if your LDAP username is "john.doe", you're fine, but in my case the company standard is "doejohn", which will lead to a scary message:

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

This message is misleading because it shows the correct email address instead of mentioning a fictitious (non-existent) username. The solution for me was to set the git username to "doejohn":

 $ git config --global user.name "doejohn" 
0
source

Source: https://habr.com/ru/post/1268125/


All Articles