Jenkins自動發(fā)送郵件配置:
打開"系統(tǒng)管理"——"系統(tǒng)設(shè)置"
1.在"JenkinsLocation"設(shè)置系統(tǒng)管理員郵件地址(重要:不能省略!)
2.在"郵件通知"部分配置發(fā)送郵件的SMTP服務(wù)器、用戶名、密碼(注意這里的密碼使用的是163郵箱設(shè)置的"客戶端授權(quán)碼",不是登陸密碼)
3.勾選"通過發(fā)送測試郵件測試配置",填入測試收件人,點(diǎn)擊"TestConfiguration"定罢,郵件發(fā)送成功提示“Email was successfully sent”
注:系統(tǒng)管理員郵件地址未設(shè)置會提示以下錯誤:
Failed to send out e-mail
javax.mail.internet.AddressException: Illegal address in string ``''
at javax.mail.internet.InternetAddress.(InternetAddress.java:114)
at hudson.tasks.Mailer.stringToAddress(Mailer.java:206)
at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(Mailer.java:574)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)