Jenkins运行结果发送邮件失败的各种坑……
已在 Jenkins的 job-构建后操作设置了邮件发送通知:(但是发送不成功,且报错)
1、跑完工程后,发送邮件触发失败 ?
Email was triggered for: Failure - Any Sending email for trigger: Failure - Any An attempt to send an e-mail to empty list of recipients, ignored. Finished: FAILURE
2、使用上一次跑的测试报告index.html(因为跑一份新的需要1个多小时,成本太大,),来打包发邮件,会报这个错误:
+ zip -r report.zip test-output/index.html
updating: test-output/index.html (deflated 96%)
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did leafNodes run?
For example, /Users/XXX/.jenkins/workspace/YYY-project/test-output/index.html is 23 分 old
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
这个问题找到解决办法:
设置了邮箱之后,又报这个错:
+ zip -r report.zip test-output/index.html
updating: test-output/index.html (deflated 96%)
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did leafNodes run?
For example, /Users/yyy/.jenkins/workspace/CXXX/test-output/index.html is 1 小时 39 分 old
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
messageContentType = text/html; charset=UTF-8
Collecting change authors...
build: 47
Adding recipients from trigger recipient list
Successfully created MimeMessage
An attempt to send an e-mail to empty list of recipients, ignored.
Some error occurred trying to send the email...check the Jenkins log
Finished: FAILURE
![](https://img2020.cnblogs.com/blog/818082/202103/818082-20210306174853700-2014644865.png)
4.2)Extended E-mail Notification
![](https://img2020.cnblogs.com/blog/818082/202103/818082-20210306175242678-1768754996.png)
4.3)邮件通知
![](https://img2020.cnblogs.com/blog/818082/202103/818082-20210306175637535-1483085404.png)
5、build #55 又发生下面这个错: —— Publish Junit test result report的问题,换成 Publish HTML Report 就不会报此错了。(详见:Jenkins安装 HTML Publisher plugin插件)
+ zip -r report.zip test-output/index.html
adding: test-output/index.html (deflated 94%)
Recording test results
ERROR: Step ‘Publish JUnit test result report’ aborted due to exception:
org.xml.sax.SAXParseException; lineNumber: 670; columnNumber: 36; 在实体引用中, 实体名称必须紧跟在 '&' 后面。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
6、出现的终极大问题:
【SendFailedException message: 451 5.7.3 STARTTLS is required to send mail [SHAPR01CA039.CHNPR01.prod.partner.outlook.cn] 】
按照对应的内容配置好了,项目构建也成功了,发送报告邮件的时候,报错。
百度了这个错,并没有找到,最后通过FQGoogle找到的一个回答是:
需要去修改Jenkins启动命令文件,在该文件中加一句命令: -Dmail.smtp.starttls.enable=true
可是找到这个一个类似的文件:是jenkins_runner.sh,发现它里面已经有上述的那句命令了……(晕了)
所以,这个也解决不了……
7、问了下IT负责人,建议SMTP服务器和端口换一个试试,于是试了如下:
smtp服务器:XXX-com.mail.protection.partner.outlook.cn
端口 25
——然后测试邮件发送就可以了!!!
posted on 2021-03-06 17:36 CuriousZero 阅读(3902) 评论(0) 编辑 收藏 举报