Jenkins email plugin does not send an email to a user who has broken the assembly

I installed Jenkins to send emails only to users who violated the assembly using the email-ext module, but I get this error:

Do not send mail to unregistered user user@example.com, because your SCM claimed that it was associated with the user ID "John Smith", which your security area does not recognize; you may need to change your SCM plugin

I really don’t understand what this error means, is the problem in our SCM or in the email plugin? Are the letters taken from the commit history if I register them somewhere so that Jenkins starts working?

For reference, this is the code around the error message in the plugin source code:

} catch (UsernameNotFoundException x) { if (SEND_TO_UNKNOWN_USERS) { listener.getLogger().printf("Warning: %s is not a recognized user, but sending mail anyway%n", userAddress); } else { listener.getLogger().printf("Not sending mail to unregistered user %s because your SCM" ........ 

How to enable SEND_TO_UNKNOWN_USERS ?

The error message is also mentioned in this report.

+15
email jenkins
source share
4 answers

Well, after some experimentation, this is what I found out:

Jenkins takes the email of the committer (not the author). For example, for a commit message that looks like this:

 Author: John Smith <author1@example1.com> 2017-07-27 17:15:39 Committer: John Doe <committer1@example2.com> 2017-07-27 17:15:39 Parent: 9c3ff18dda8ca6f7b7ac4ebab4c76d3c85891a33 (commit) Branch: master 

Jenkins will take "committer1" and create a completely new user under People with the user ID "committer1" and email "". If this user does not have a password, it will be considered unregistered, so you need to go to the settings for this user and add a password field to it:

enter image description here

So, this is one way to fix the error, but you have to do it for each user, and in a large team it can be tedious.

+12
source share

For version V2.61 or higher, this can be configured using the switch.

Go to

Jenkins Management -> System Setup -> Advanced Email Notification

and check the box Allow sending to unregistered users

enter image description here

+25
source share

Put the line below in your jenkins script run

 -Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true 

The latest Jenkins security directive allows mail to be sent to registered users. The line above bypasses this configuration.

+8
source share

Given that jenkins takes the first part of the email address and creates the user, I have my jenkins username be the first part of their email address in my team. This eliminated the need to support two separate users.

+1
source share

All Articles