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 [email protected] else send it to requestor.
Tried : couple of plugins but didn't help much as they were post-build plugins
Select “Configure”. Select “Add post-build action” and Click “E-Mail Notification”. Enter your recipients mail address and select first option “Send e-mail for every unstable build”. Click “Save” button.
Click on Manage Jenkins from Left Pane. Click on Configure System under the System configuration. Under the Email Notification. Put the SMTP server as smtp.gmail.com in SMTP server field.
Jenkins comes with an out of box facility to add an email notification for a build project. Step 1 − Configuring an SMTP server. Goto Manage Jenkins → Configure System. Go to the E-mail notification section and enter the required SMTP server and user email-suffix details.
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With