Jenkins send email as a promotion action - jenkins

I want to send emails for certain promotions. The default email notification only sends after a build, not a promotion.
I tried the editable email notification (email-ext) as an action in a promotion and added my email but it said "No emails were triggered." on running the promotion. Is there a way to make it work?
I will have to fall back to a powershell action if email-ext doesn't work.

I tried the email-ext with the "Always" trigger under advanced and it worked.

Try the Any Build Step plugin, in the Promotion action, select Conditional Build step, select "Always" condition, and select Email-Ext action.

Related

Send mail having test results generated at jenkins ui

I am trying to send generated test results via mail. I am able to see the summary of test cases generated at jenkins ui at http://<URL>:8080/job/<JOB_NAME>/<BUILD_NUMBER>/testReport/. How ever I want to send this in email, but, unable to find any solution for this. Does anyone knows how to do that??
you can use "Editable Email Notification" plugin and attached the build logs

Jenkins Pipeline approval by clicking a button in email

Is there a way that user could approve the Jenkins pipeline input from email?
Hi
There is a Deployment for build #####
Please click on Approve(this should be a approval link) or Reject(this should be some rejection link)
Instead of user clicking on the Build URL and then going there and clicking on approve or abort
Is it possible in Jenkins Pipeline?
currently i tried buildurl/input/approve and buildurl/input/abort but those doesnt seem to work
You can probably try something with triggering remote builds for your job .You can make a central file which is placed at an accessible server and you could hit that url with your parameters .Check this page for more info:
https://github.com/dnschneid/crouton/issues/2654

How to send mail in Jenkins at the beginning of a job?

We used our own custom action to send mail that once the automation has been started from Final builder. Now am using Jenkins. As long as i have searched, i found that we can send mail about Jenkins job success or failure at the end of Job. Is there any possible to send mail at the beginning of Jenkins job started? If so, what plugin do i need to use for it? Please help me on this.
You can use Email Extension plugin.
To configure see the article How to send Email at every build with Jenkins. After configuring the settings follow these steps:
Select Add post-build action
Choose Editable Email Notification
In Project Recipient List you can use either default list or recipient's e-mail address
Select Avanced Settings...
Select Add Trigger and choose Before Build
That's it.

jenkins email-ext plugin stopped work

I have unclear situation with email notification. When email triggering from job, I get "MessagingException message: 535 5.7.3 Authentication unsuccessful", but when I go to Manage jenkins -> configure system -> E-mail Notification, and run "Test configuration by sending test e-mail" I get "Email was successfully sent" and email to mail box. "E-mail Notification" and "Extended E-mail Notification" using the same SMTP server, and 2 days ago all working good. I'm at a loss... Any ideas, where to look for the problem? Thanks !
Update:
It seems problem precisely with email-ext plugin. Because, I added to my job two notifications section, first usual notification (Send e-mail for every unstable build) and second "Editable email notification", and I get a result: first notification successfuly sent, second says "535 5.7.3 Authentication unsuccessful". Two days ago I change password for email, and made changes to the jenkins settings. But it looks like email-ext plugin try authenticate with old password. May be somebody knows, how to reset plugin settings ?
The reason is that the plugin doesn't update settings... It can be done manually, /var/lib/jenkins/hudson.plugins.emailext.ExtendedEmailPublisher.xml , need update hash in <smtpAuthPassword></smtpAuthPassword> section.

Jenkins ext-email plugin fails to send email on build success

I have Jenkins version 1.480.3 installed on my machine and Email-Extension Plugin 2.28.
I have configured my jobs on Jenkins and everything works fine except the final build success email.
I have configured four triggers for Email-Extension plugin:
Failure
Success
Unstable
Before Build
For all the triggers I have enabled "Attach Log" and all works fine except the "Success".
I get the following message on screen:
Email was triggered for: Success
Sending email for trigger: Success
Request made to compress build log
Sending email to: abc#example.com def#example.com
Error sending to the following VALID addresses: abc#example.com def#example.com
Notifying upstream projects of job completion
Capturing build context information.
Finished: SUCCESS
Please could someone help me since I really have no clue how to resolve this.
I had this problem too. In the end, it was because my attached build log was too large! The SMTP server refused to send out the e-mail causing the error message:
Error sending to the following VALID addresses: ...
Disabling the option to attach the build log or fixing the output of my build to not dump so much text fixed the problem:
Looks like a bug in the plugin. Here's a workaround:
In the global settings for the plugin make sure to provide a full e-mail address for System Admin E-mail Address, (e.g. foo#bar.com, not just foo), even though you've specified the Default user E-mail suffix. The address itself can be bogus, though.
For Email, you have to install following plugins.
Email-ext plugin
Email-ext Template Plugin
To provide the configuration, go to the Jenkins System configuration page (Jenkins > Manage Jenkins > Configure System > ” E-mail Notification ” section). You will be able to see the below screen to add email configurations:
SMTP server name : smtp.gmail.com
User name : user_email_id#gmail.com
Password : user_email password
Use SSL : Checked
SMTP Port : 465
Now, configure “Extended E-mail Notification” section. You will be able to see the below screen. Fill the same value as above parameter.
Now, Click on Default triggers at bottom right corner and select success. Apply and save you configuration.
Now Goto your job and Click the Add post-build action drop-down, select E-mail notification option.
Enter the recipient email id in the ‘E-mail Notification’ box and select the checkbox next to the ‘Send e-mail for every unstable build’ option.
Click the ‘Add post-build action’ drop-down and select the ‘Editable Email Notification’ option.
In Project Recipient List , This is a comma separated list (optional whitespace after commas) of email addresses that should receive emails. May contain references to build parameters. To CC or BCC someone instead of putting them in the To list, add cc: or bcc: before the email address (e.g., cc:someone#example.com, bcc:bob#example.com).
In Attachments field, you have to give the path of your binary file (i.e path of your .ipa file like, build/artifacts/IPA-Name.ipa)
Now click on Advanced Settings at bottom right corner. Click on Add trigger and select Success trigger. Click on Add drop down from the success trigger and select Recipient List option. Apply and Save your configuration.
n mac-mini for iOS job configuration, if email is not send and gives you java exception error message then you must turn on less secure apps.
I also had this problem, and it was because I forgot to set the SMTP server (in the plugin section of configuration), but only saw the default SMTP server settings.
My first guess is that the global jenkins email configurations are not set correctly.
Manage Jenkins -> Configure System -> E-mail Notification
This is the default plugin, not the extended one you installed manually. The SMTP server field defaults to localhost, so unless you have an email server setup and running on the same box, this needs to be set.
If that is set then I would try telnet'ing to your email server from your Jenkins server to make sure there is not a connection error.
After days of search for answer, it turns out the gmail has attachment limit for 25 mb, and my output is larger than that.
Check your output size if you met this issue and you are using gmail for mail server.
Refer all above solutions, if it doesn't work. You can try this solution.
Zip file is blocked in Gmail. You should rename your zip file inside script before send it. (Example: file.zip.abcxyz). I solved my problem.
I had the same problem. It turns out that for some reason, Jenkins would not save my "Extended E-mail Notification" SMTP settings. At one point, it did save the setting and the emails started working. Make sure that the bit in red is selected and double-check it after you press Save:
If every thing fails, try restarting jenkins process. That solved for me. Somehow the Jenkins system was unable to load all of the configs without a restart? But give it a try.
Today i faced this issue on a jenkins machine that was sending emails just fine till a couple of weeks ago. I turned it on today and it just wont send emails because of "Error sending to the following VALID addresses"
I tried these steps:
Made sure I am not attaching any log file in the email.
Made sure "System Admin" email has the domain name mentioned.
Jenkins was able to successfully send emails to me when i tried it by "Test configuration by sending test e-mail"
Downgraded my email ext plugin.
None of the above mentioned steps helped.
Finally i replaced my company's SMTP server with the jenkins default server and it worked just fine. Not sure why this has happened, I need to talk to my IT guys and see if they have enabled any new security in SMTP server.
Hope this helps to people who hit this same issue.
Thanks

Resources