How to Configure Email Notification in Jenkins?

  1. Open Jenkins using the following URL: http://localhost:8080/ on any browser.

Open Jenkins

2. Click the ‘Manage Jenkins’ menu option displayed at the right side of the screen. You will be redirected to the ‘Manage Jenkins’ page, where you need to select the ‘Manage Plugin’ option.

Click the ‘Manage Jenkins’ menu option

3. Click the ‘Available’ tab present at the top of the ‘Manage Plugin’ page.

Click the ‘Available’ tab present at the top of the ‘Manage Plugin’ page.

4. Start typing ‘Notification’ in the ‘Filter’ field displayed at the top-right side of the ‘Manage Plugin’ page. Click the checkbox next to the ‘Email-ext plugin’ option. Click the ‘Install without restart’ button.

 Click the checkbox next to the ‘Email ext plugin’ option. Click the ‘Install without restart’ button.

5. Now, click the checkbox next to the ‘Email-ext Template Plugin’ option. Click the ‘Install without restart’ button.

click the checkbox next to the ‘Email-ext Template Plugin’ option

6. Go to the Jenkins home page and click the ‘Manage Jenkins’ menu option. Then, select the ‘Configure System’ option.

Go to the Jenkins home page and click the ‘Manage Jenkins’ menu option

7. Enter the SMTP server name under ‘Email Notification’. Click the ‘Advanced’ button and then click the checkbox next to the ‘Use SMTP Authentication’ option. Now, set the following fields.

image007

8. Check the email notification functionality by clicking the checkbox next to the ‘Test configuration by sending Test e-mail recipient’ option. Enter a valid email id and click the ‘Test configuration’ button to check whether the email id is valid or not.

Check the email notification functionality by clicking the checkbox

9. Go to the home page and click on a created job, like Homes. Then, click the ‘Configure’ option.

Go to the home page and click on a created job, like Homes. Then, click the ‘Configure’ option.

image010

10. Click the ‘Add post-build action’ drop-down.

Click the ‘Add post-build action’ drop-down.

11. Select the ‘E-mail Notification’ value.

Select the ‘E-mail Notification’ value.

12. 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.

Enter the recipient email id in the ‘E-mail Notification’ box

13. Click the ‘Add post-build action’ drop-down and select the ‘Editable Email Notification’ value.

Click the ‘Add post-build action’ drop-down and select the ‘Editable Email Notification’ value.

14. Fill the ‘Editable Email Notification’ fields.

image015

15. Click the ‘Advance Settings…’ button in the ‘Editable Email Notification’ box.

16. Click the ‘Add Trigger’ drop-down and select the ‘Always’ option.

Click the ‘Add Trigger’ drop-down and select the ‘Always’ option.

image017

17. Click the ‘Save’ button.

18. Go to the home page and click on the job, like Homes.

19. Click the ‘Build now’ link and check the email id after the job execution.

You may also like – How to Use GitHub Plugin for Jenkins

SHARE THIS

Get A Free Quote

  • Mohammad Azharuddin

    Good and thanks

    • Nimisha Sreenivasan

      i have getting like “An attempt to send an e-mail to empty list of recipients, ignored.Finished: SUCCESS” but mail is not getting

  • Usha Yadu

    I added trigger for scucess ,but dont receive the mail for the same

  • Marwa Ahmad

    Thank you! Straightforward steps.

  • Rohit Pal

    great!!. Thanks a lot. Initially faced some exception, but later got it fixed by installing Token Macro plugin. Thanks.

    • Ramesh

      hello when build completed successfully and then iam getting address
      not yet configured in from address could you please help how to set the
      from address as domain name

  • Alex

    Step 7: “SMTP Port: 456” -> there is a typo. It should be ‘465’ instead of ‘456’. Screenshots are correct.

    • Ramesh

      hello when build completed successfully and then iam getting address not yet configured in from address could you please help how to set the from adress as domain name

  • Mohan

    hi,

    I am facing this exception while configuring “Email Notification “.. with in Jenkins Please help me

    Failed to send out e-mail

    javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    nested exception is:
    java.net.ConnectException: Connection refused: connect

    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)

    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)

    at javax.mail.Service.connect(Service.java:317)

    at javax.mail.Service.connect(Service.java:176)

    at javax.mail.Service.connect(Service.java:125)

    at javax.mail.Transport.send0(Transport.java:194)

    at javax.mail.Transport.send(Transport.java:124)

    at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(Mailer.java:566)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:497)

    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)

    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)

    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)

    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)

    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)

    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)

    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)

    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)

    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)

    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)

    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)

    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)

    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)

    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)

    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)

    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)

    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)

    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)

    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)

    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)

    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)

    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)

    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)

    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)

    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)

    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)

    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)

    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)

    at org.eclipse.jetty.server.Server.handle(Server.java:370)

    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)

    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)

    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)

    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)

    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)

    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)

    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at java.lang.Thread.run(Thread.java:745)

    Caused by: java.net.ConnectException: Connection refused: connect

    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

    at java.net.Socket.connect(Socket.java:589)

    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:656)

    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)

    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:205)

    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)

    … 65 more

  • Ritesh Sharma

    Hi Team,
    It seems that in my case somehow jenkins is not considering ext-email specifications , instead of filled information (mail subject,body, attachment ) it sending default mail (with build log) to the recipient specified in default email notification’s specification.

    If anyone knows the solution for this then kindly help !!