简体   繁体   English

无法从 jenkins 发送 email 通知

[英]Unable to send email notifications from jenkins

I am using Jenkins on linux.我在 linux 上使用 Jenkins。

I am not able to send email notifications through jenkins.我无法通过 jenkins 发送 email 通知。
I have done the extended email setup as below我已经完成了扩展的 email 设置,如下所示在此处输入图像描述

And when I use the the configuration to send email using jenkins job as below当我使用配置发送 email 使用 jenkins 作业如下
在此处输入图像描述
It throws the below error它抛出以下错误

Build step 'Invoke top-level Maven targets' marked build as failure
Sending e-mails to: my-email@live.com
ERROR: Couldn't connect to host, port: localhost, 25; timeout 60000
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout 60000;
  nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2210)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722)
    at javax.mail.Service.connect(Service.java:342)
    at javax.mail.Service.connect(Service.java:222)
    at javax.mail.Service.connect(Service.java:171)
    at javax.mail.Transport.send0(Transport.java:230)
    at javax.mail.Transport.send(Transport.java:100)
    at hudson.tasks.MailSender.run(MailSender.java:130)
    at hudson.tasks.Mailer.perform(Mailer.java:176)
    at hudson.tasks.Mailer.perform(Mailer.java:139)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
    at hudson.model.Build$BuildExecution.post2(Build.java:177)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:697)
    at hudson.model.Run.execute(Run.java:1932)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:607)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:333)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:214)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2160)
    ... 18 more

Enter your SMTP server information in the "E-mail Notification" section of the global configuration instead of the " Extended Email Notification Plugin" section.在全局配置的“电子邮件通知”部分输入您的 SMTP 服务器信息,而不是“扩展Email 通知插件”部分。

You're using the E-Mail notification "post-build" step.您正在使用电子邮件通知“构建后”步骤。 That is unrelated to the "Extended Email Notification Plugin", so it does not use the corresponding settings either.这与“Extended Email Notification Plugin”无关,因此也没有使用相应的设置。

Did you enable "not secure app" connections in your Google Settings?您是否在 Google 设置中启用了“不安全的应用”连接? It surely be mandatory to use the google account in third apps.在第三个应用程序中使用谷歌帐户肯定是强制性的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM