In Jenkins, Is there a way to send a mail when starting a build.
I know there is a post-build email notification which sends mail to the given recipients after a successful or failure build. Similarly i am expecting something like pre build notification.
Also is there a conditional email like if username == null send to xyz@domain.com else send it to requestor.
Tried : couple of plugins but didn't help much as they were post-build plugins
- Install the Email-ext plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
Notice that a post build action will solve your problem even though what you intend is to send an e-mail before the build.
After that, go to the job configuration and "Add Post Build Action" > "Editable Email Notification"
Press Avanced Settings:
Now, at Triggers, just add a new trigger and choose "Before Build"
For the second part, the solution is to put the recipient list in an environment variable (for example, a string parameter called EMAIL_RECIPIENT) and then use that in the editable email notification recipients list box as ${EMAIL_RECIPIENT}.
If you have sendmail configured, just use the "Execute shell" section and write the code to send mails before the build starts.
You can try the Extend Email-ext, it has the Before build in the Triggers section.
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin