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

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

Related

How to fix the extended email plugin error "An attempt to send an e-mail to empty list of recipients, ignored"?

I am using Jenkins 2.11 version with extended email plugin (v 1.61). I have set the default triggers to "Always" and "Failure- Any". Using Blue ocean plugin a Jenkins file is created and used to run the job. The settings of the email plugin and jenkins file is attached. The problem is sometimes the jenkins is not able to send the email and logs an message "An attempt to send an e-mail to empty list of recipients, ignored" and sometimes it works fine. How do i fix it?

CI - Xcode 9 Server doesn't send email after integration

I was able to setup Server & Bots with Xcode 9 (ref). The integration can be run smoothly. However, the expected email report is never sent.
I've already setup my Mac to send emails using postfix. For example, I can run this command and then receive the email:
$ date | mail -s test1 nigong#mydomain.com
To make Xcode send email, I have done the following setups:
However, no email is sent or received. I wonder if there is any additional setup is needed.
Any help is appreciated. Many thanks!
After 20 hours searching I finally found the problem. I will try to describe the needed steps to get this working:
On your CI server the postfix SMTP server needs to be configured and working. There are multiple tutorials on the internet. The one I used was this one:
https://blog.anupamsg.me/2012/02/14/enabling-postfix-for-outbound-relay-via-gmail-on-os-x-lion-11/
However, I still was not able to sent a mail with the mail command after I configured everything like explained in the tutorial.
The missing piece was the Gmail setting for "less secure apps". Gmail does not allow sending emails over their SMTP even if login and password are correct. The SMTP server needs to fulfill special requirements. (which I am not aware of...) However, it is possible to losen that restriction and allow access from any SMTP. Here:
https://support.google.com/accounts/answer/6010255
Set "Allow less secure apps" to On. I recommend creating a dedicated Gmail account just for this and not to enable this setting on your day-to-day email account.
Now everything was working and I was able to successfully send mails with the macOS cli command mail.
The last step needed to solve this was to setup the Xcode server settings correctly. (and this is what basically answers OP's question). So, the correct setup (after mail cli works) was to not set any settings in Xcode server. Just remove all the settings, then Xcode server will fall back to postfix.
Just remove all settings, that's it. Now Xcode CI server sends successfully emails.

Jenkins Email sending fails

I set up the JENKINS Editable Email notification for my project with trigger for all builds.
the build runs successfully but the emails does not send.
The follwing is the result in the console output.
BUILD SUCCESSFUL
Total time: 43 seconds
Email was triggered for: Always
Sending email for trigger: Always
Sending email to: chauhanheena#gmail.com
Connection error sending email, retrying once more in 10 seconds...
Connection error sending email, retrying once more in 10 seconds...
Failed after second try sending email
Finished: SUCCESS
Make sure SMTP server is configured under "Manage Jenkins" -> "Configure System" -> "Extended E-mail Notification"
Note also that depending on your plug-in set up, you may have another place to configure SMTP server. For example under "Manage Jenkins" -> "Configure System" -> "E-mail Notification".
That is not needed for this particular plug-in but it may lead you think you have everything done, while it is not :)
You should set SMTP Server and Authentication in both E-mail Notification and Extended E-mail Notification sections. Click Advanced button to see this Use SMTP Authentication section.
If issue still persists, then just restart jenkins, it will work. Somehow the Jenkins system was unable to load all of the configs?
A little late to the party but here's how I made it work in my case. I was trying to authenticate the credentials with AWS SES.
TLDR: Try a different SMTP Port. Changing the port from 587 to 465 allowed Jenkins to authenticate with AWS SES.
And for those who are curious. Here's how I figured out what the issue was.
Go to following location.
Jenkins > Manage Jenkins > Configure System
Scroll down until you find the following option to Enable Debug Mode. See below.
And after enabling the debug mode, the console output became a lot more detailed and I could see the below at the very end.
Changing the SMTP Port allowed Jenkins to go through. SES allows the following ports.
Port: 25, 465 or 587
Hopefully that should fix the issue and allow emails to flow though. Or else the the debug mode might steer you in the right direction.
EDIT: Important
The email I was trying to send was from the Editable Email Notification section.
Jenkins > Project $Project_Name > Configure > Post Build Actions > Add Post Build Action > Editable Email Notification.
I was also facing the same issue but again i revisit below things and
it worked.
First make sure email notification related plugins are installed (Manage Jenkins->Manage Plugins->Check if email related plugins are
installed or not)
Then Go to Configure System(Manage
Jenkins->Configure system) and navigate to Extended E-mail
Notification section and provide
SMTP server-smtp.gmail.com
Check -Use SMTP Authentication
Provide User name (say your gmail)and corresponding password( Email address from where email will trigger upon completion of build,Note -you need to turn on allow option for secure app to sign in from gmail settings)
USe SSL-cheked
SMTP Port-465
Add your gmail in Reply to list also.
In E-mail Notification also provide - smtp.gmail.com
Save above all.
Now all you need to do is to set up post build section - Open ur project and in post build section( From your Projecct click on configure), provide desire email address(to whom you want to send the email) on Recipients field of Email Notification/Editable Email Notification field Now go ahead
with build now.
I was having the same issue, and the only way I could send emails was using mail:
mail(
bcc: '',
body: "<p>your body</p>",
cc: '',
charset: 'UTF-8',
from: '',
mimeType: 'text/html',
replyTo: '',
subject: "your subject",
to: "your-email#mail.com"
)
Since I don't know the error log of your issue, I will try to give what worked for me.
I tried everything else but the below step saved me.
Hope it will help someone with the similar issue.
I just set the System Admin e-mail address correctly.
here are detailed steps:
Try this out and test again to send:
These steps are already given in other solutions but still writing down here for completeness: Fill up SMTP server, set Default user e-mail suffix as
#somedomain.com, check Use SMTP Authentication, put username and password, check Use SSL, set SMTP Port, set Charset to UTF-8.
Open: Manage Jenkins > Configure System
Find Jenkins Location option
Fill the System Admin e-mail address like this:
your-name <email-id#somedomain.com>
Try sending test email again.
Does your Jenkins Config have an SMTP server set up correctly? Have you tested the config with a test email?
Go to "Manage Jenkins" -> "Configure System" and scroll to the bottom to make sure these are set up correctly.
If you servlet container server doesn't have an SMTP server, then you need to find whatever your Outlook is connected to, and see if you can use that. You may need to provide credentials for authentication depending on the server's setup.
Under Manage Jenkins -> Configure System:
fill in the section "Extended E-mail Notification" as per your "E-mail Notification" section.
That should work.

Jenkins email-ext plugin not sending mail

I have Jenkins version 1.480.3 installed on my machine and Email-Extention Plugin 2.30.2.
Test mail from "Manage Jenkins" section works fine. When I add editable email notification to my jobs, I am not receiving it.
Also tried configuring "Triggers" in editable email notification advanced section. That also didn work. Console logs of build shows email has been triggered.
Can someone help me on how to debug this?
At first you have to create a template http://url-to-jenkins/emailexttemplates/.
In the field "Project Recipient List" you can add some emails (comma separated).
You can also insert global variables (Manage Jenkins > Configure System > Global properties) with:
${ENV, var="PATH"}
The "Advanced Settings..." option provides a trigger management, just add "Recipient List" and now you should get some emails by Jenkins.
It appears that, in some version Extended E-mail Notification become own SMTP Server configuration.
So check your configuration under "Manage Jenkins" -> "Configure System" -> "Extended E-mail Notification" and make sure that fields "SMTP Server" and " Default user E-mail suffix" are filled properly.
Make sure also that the configuration is consistent with "Manage Jenkins" -> "Configure System" -> E-mail Notification.
TL;DR
Fill out fields "SMTP Server" and " Default user E-mail suffix" under "Manage Jenkins" -> "Configure System" -> "Extended E-mail Notification"
Wasted few days.
Also tried to Downgrade the email-ext plugin to 2.25
but this Doesn't help.
Test mail sended, In Console Log was Sending email to: mymail
But stiil have no messages.
I found solution that help me....
I used gmail. So I Verifeid my gmail account via cellphone, than I fill Security Settings and gave Access to my account from unreliable sources.
Then I fill that mail into Use SMTP Authentication in Global Settings.
That worked for me :)
Check if you have SSL enabled under SMTP Auth settings. For me, I was able to see a successful trigger, but email was never sent.
I spent hours trying to resolve this issue, I've implemented everything mentioned here, and didn't work for me, the solution that worked for me was to uninstall the plugin and install it again!
Downgrade the email-ext plugin to 2.25
This is a long shot. But chrome was auto filling my SMTP Authentication password, so when I changed any setting and clicked save, the password would also be overwritten.
Hopefully I can save someone else a headache!
Short Description of problem that I was facing:
When I was sending test mail from Manage Jenkins -> Configure System
-> E-mail Notification, I was able to successfully send and receive emails but there is no such option to test email in Extended E-mail
Notification tab
While running a job, when I was sending email in post-build step via E-mail plugin, I was able to successfully send and receive emails but with same settings, I was getting following error on sending mail via Extended E-mail:
MessagingException message: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials
I went almost crazy searching for resolution of this issue.
I tried every resolution mentioned on this page but no success. I even tried downgrading the plugin to 2.25 but I was still getting error when sending email via Extended E-mail plugin. Everywhere on internet also the only solution mentioned to solve this problem was to "Allow less secure apps" and to check if credentials are valid, which in my case were valid since I was able to successfully send mail via normal email plugin.
After struggling for a few days, I finally found the silly thing that was causing this issue.
I had to type-in email ids into each and every box in:
Manage Jenkins -> Configure System -> Extended E-mail Notification.
Copy-pasting email ids or domain names is causing this annoying and time taking issue. So, in case if you fall in such a situation, please make sure you have handwritten email ids in each column and not copy pasted.
Following configurations for "Extended E-mail Notification" worked for me:
Email Extension Plugin : 2.69
SMTP server : smtp.gmail.com
Default user E-mail suffix: <left this blank>
Enabled Use SMTP Authentication
User Name: <email id of account through which email is to be sent>
Password: <Password of account through which email is to be sent>
Advanced Email Properties : <left this blank>
Use SSL : Enabled
SMTP port: 465
Charset: UTF-8
Also, I had enabled less secure apps.
Hope this saves someone's time!!
Sometime after 2.66, if the From field is not set in the project, it doesn't seem to be falling back to the system email address. I believe this ticket is tracking the issue. https://issues.jenkins-ci.org/browse/JENKINS-63522
i performed the following action (after hours and hours of investigation)
and at the end it worked for me.
Unistalled the Extended mail plug in.
Deleted from .jenksins the plugIn (it remains also after Unistall).
Reinstalled the Extended mail plug In and enabled it.
Restart Jenkins.
In the Jenkins Configure System, in the Extended E-mail Notification section,
I set a new credential access to my gmail account
(also the previous credential stored were correct but i preferred to generate a
new one with a different description).
And then... Finally afteer several time on this matter it works for me!.
Try to use Extended E-mail Notification > Enable Debug Mode (selected). It will show you more logs in the Job Run Console section.
In my case, it showed me in the logs that credentials copied from regular email-ext (AK_AWS_SES_CREDENTIALS/****** (Migrated from email-ext username/password)) were not able to connect to AWS SES SMTP service.

Jenkins email configuration - Test email configuration succeeds but email is not received by user

I am Using Jenkins v1.521 on Windows 2008 R2 server. I need to enable email build notifications in the builds. I have also installed email ext plugin.
I have configured the SMTP server details under Configure System in Jenkins.
I tried sending the test email from Jenkins using "Test Configuration" option providing my email address and I get a message that says "Email successfully sent" but I don't seem to be receiving the email.
I also tried doing a telnet to the SMTP server directly on the server hosting Jenkins and sent an email manually and it worked. I received the email.
I wonder why the mail sending part does not work via Jenkins?
Could any one please provide me suggestions to fix this issue?
In order to get this to work, a valid email must be entered into the "System Admin e-mail address" field. That field is on the same page but is located in another section higher up. Without doing so, I too received a message that the email was successfully sent but I never received it. Once I set it, the test emails started to be received properly.

Resources