Kohei Nozaki's blog 

How to send Email at every build with Jenkins


Posted on Saturday Feb 22, 2014 at 09:34PM in Jenkins


Environment

  • Email-ext plugin 2.37.2
  • Jenkins 1.551
  • Apache Maven 3.1.1
  • git version 1.8.3.4 (Apple Git-47)
  • Oracle JDK7u51
  • OS X 10.9.1

Install Email-ext plugin

  • Install Email-ext plugin at plug-in install page of Jenkins

Configure System

“Jenkins Location” section

  1. Enter valid email address to “System Admin e-mail address”

“Extended E-mail Notification” section

  1. Enter your email address to “Default Recipients”

“E-mail Notification” section

  1. Enter your SMTP server name to “SMTP server”
  2. Click “Advanced”
  3. Click “Use SMTP Authentication”
  4. Enter required informations
  5. Check “Test configuration by sending test e-mail”
  6. Click “Test configuration” to send test email
  7. Click “Save” in the bottom of the page

Configure a project to send email at every build

  1. Click “Add post-build action”
  2. Click “Editable Email Notification”
  3. Click “Advanced Settings…”
  4. Click “Add Trigger”
  5. Click “Always”
  6. Save

Test-run

  1. Click “Build Now”
  2. Check Console output and received email
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.497s
[INFO] Finished at: Sat Feb 22 22:27:21 JST 2014
[INFO] Final Memory: 18M/245M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /Users/Shared/Jenkins/Home/jobs/BuildAndTestHead/workspace/hellojenkins/pom.xml to org.nailedtothex/hellojenkins/0.0.1-SNAPSHOT/hellojenkins-0.0.1-SNAPSHOT.pom
channel stopped
Archiving artifacts
Email was triggered for: Always
Sending email for trigger: Always
Sending email to: kyle@example.com
Finished: SUCCESS

References

  1. Email-ext plugin - Jenkins - Jenkins Wiki



Comments:

Hi, thanks

Posted by sai on May 28, 2015 at 03:55 PM JST #


Hi, I am new to webdriver and i want to know the steps and code details for sending an email auomatically whenever the tests have been executed through apache ANT+testNG with the help of build.xml file.So, could you please help me on this?

I am looking forward for your favourable reply.

Thanks and regards,
varma.

Posted by Praveen on June 12, 2015 at 04:33 PM JST #


Hi varma, I'm not quite sure about your situation, but I guess MailLogger would help. for detail check https://ant.apache.org/manual/listeners.html#MailLogger

Posted by Kohei Nozaki on June 12, 2015 at 04:44 PM JST #


Hi,

I want to listed out in email , total test cases , total test cases passed and total test cases failed and Skipped.

Posted by Sandeep on July 11, 2015 at 03:56 PM JST #


Hi Sandeep, I think Token Macro Plugin would help you. for detail check https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin

Posted by Kohei Nozaki on July 14, 2015 at 08:21 PM JST #


hola!!!!!
al llegar el mensaje me manda el link pero no me permite acceder
que porcederia?
buen dia

Posted by oscar on October 23, 2015 at 06:48 AM JST #


Thanks a lot, this was very usefull.

Posted by Warren Castro on March 04, 2016 at 10:39 AM JST #


HI

i am building multiple projects using post build option[jenkins],Is there any way to get the consolidated email about status (which build is passes and which one is failed) in ONE EMAIL

Posted by Thejasvi RM on May 19, 2016 at 05:52 PM JST #


hi

Posted by ram on August 04, 2016 at 04:16 PM JST #


Hi All,

This is one of the methods that we can use to send the build information to the stake holders/ developers. But i have done another method to send the report in a detailed manner. I have accomplished that my creating windows batch command to copy the result to another tomcat. After copying i have included the URL in the email. So that they can check / download the artifacts from the URL.

Posted by Ashok Manghat on October 18, 2016 at 08:19 PM JST #


Hi

I am using email ext plugin in jenkins to send the emails. I use command
${FILE, path="target/jmeter/reports/Service-durations-20170126-EPFTestPlan.html"}. My problem is filename "Service-durations-20170126-EPFTestPlan.html" has timestamp in it. So what it means is filename will keep changing everyday. How can I use wildcards to ignore timestamp in file name. example:${FILE, path="target/jmeter/reports/Service-durations-********-EPFTestPlan.html"}. Problem here is wildcards are not picked up due to double quotes.

Appreciate any help.

Posted by Rahul on January 28, 2017 at 02:48 AM JST #


Thank you for the blog, it helps me a lot

Posted by Kishor Jangir on April 29, 2017 at 03:02 PM JST #


HI ,
How can i send coverage results as notification of email body not attachment or link.. we receive coverage roprts as an email message in body of email notification

Posted by jagan on October 03, 2017 at 02:38 AM JST #


@Kohei Nozaki - As per your blog I am getting below output -

channel stopped
Email was triggered for: Always
Sending email for trigger: Always
Sending email to: kyle@example.com
Finished: SUCCESS

But I m not getting mail.

Posted by ashu on October 03, 2017 at 10:11 PM JST #


@Kohei Nozaki - I am also facing same issue. please help me on this.

channel stopped
Email was triggered for: Always
Sending email for trigger: Always
Sending email to: kyle@example.com
Finished: SUCCESS

But I m not getting mail.

Posted by kk on November 23, 2017 at 03:13 AM JST #


@ashu @kk I think checking debug output of JavaMail would help. Try setting the system property mail.debug=true and checking Jenkins log. FYI: http://jenkins-ci.361315.n4.nabble.com/JIRA-JENKINS-16746-Unable-to-send-email-since-Jenkins-1-500-td4655056.html

Posted by Kohei on November 23, 2017 at 09:29 AM JST #


Leave a Comment

HTML Syntax: NOT allowed