Setting up Jenkins email sender configuration correctly
To set up the configuration for sending email on Jenkins correctly, it’s necessary to set options in two quite separate locations within the main Jenkins configuration. Since this has tripped me up a couple of times, I decided to write up the problem and its solution in the hope that others don’t fall into the same trap.
An incomplete sender configuration
Consider the situation: you’ve just set up your brand new
Jenkins server and have happily entered your
default user email suffix and your
Reply-To address in the relevant fields
of the Email Notification configuration section1. You
cheerfully click on the Test configuration by sending test e-mail
checkbox, enter the Test e-mail recipient value and click the Test
configuration button only to find that no test email ever arrives. If this
has ever happened to you, read on.
Digging further, you notice that there are error messages in your postfix
logs about the unknown email address
nobody@nowhere. “But why is that
address being used?”, you ask yourself, “I set the domain name correctly in
the Default user e-mail suffix field”. Well, your problem could just be
that you’ve forgotten to configure another parameter, namely the System
Admin e-mail address field within the Jenkins Location section.
Obvious, right? Nope.
A more complete sender configuration
If you scroll to the Jenkins Location section of the main Jenkins
configuration page1 (which will be roughly at the top of the
page, whereas the Email Notification section will be at roughly the
bottom of the same, fairly long, configuration page) you will find the
System Admin e-mail address field. This is the missing piece of the
puzzle. Entering your admin email address here (e.g.
and returning to the Email Notification section and testing the email
configuration again, you should (hopefully) find that email delivery now
works as expected. Yay!
Given the How can I set the Sender’s address in Jenkins? question on StackOverflow, it seems I’m not the only person to have been bitten by this issue, so it’s reassuring that I’m not alone. The best answer to this question also mentions the solution I stumbled upon as well as that the solution isn’t obvious. Again, it’s nice to have company!
Setting up the Jenkins email configuration isn’t that hard–and once it’s set up correctly it just keeps on keeping on–one just needs to be aware of a couple of tricks to get things right. It’s interesting that this still seems to be an issue with the Jenkins configuration even though (given the age of the StackOverflow question) it seems to be at least 8 years old!
Is there anything that I’ve missed? Was this post helpful? How could I make it better? Let me know in the comments section or simply drop me a line via email or ping me on Twitter.