33

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
diidu
  • 2,523
  • 14
  • 30
Roam
  • 331
  • 1
  • 3
  • 3

8 Answers8

52

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 :)

diidu
  • 2,523
  • 14
  • 30
  • 8
    This was exactly my issue - I didn't realize that, with the email-ext plugin installed, there are _two_ SMTP server fields when configuring jenkins! – Jordan Aug 13 '15 at 23:32
9

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?

Pankaj Shinde
  • 2,102
  • 1
  • 25
  • 35
4

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.

Enable Debug mode

And after enabling the debug mode, the console output became a lot more detailed and I could see the below at the very end.

Console Output of the build

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.

2

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"
)
Brother
  • 1,685
  • 1
  • 14
  • 18
2

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.

0

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.

0

Under Manage Jenkins -> Configure System: fill in the section "Extended E-mail Notification" as per your "E-mail Notification" section. That should work.

Colin Q
  • 51
  • 2
0

If you are using Gmail and have two step verification, you may need to use an App Password rather than your own. You can follow the steps in the article from the Google Support if that is your case: https://support.google.com/mail/answer/7126229?hl=en