首页 > 代码库 > [Jenkins]怎样自定义发出邮件的 From Email Address 和 From Name

[Jenkins]怎样自定义发出邮件的 From Email Address 和 From Name

在Jenkins上建了一个执行SoapUI的task,想要自定义发送邮件的地址和姓名,怎么办呢?

在Editable Email Notification里面添加Pre-send Script

脚本如下:

import javax.mail.Message.RecipientTypeimport javax.mail.Addressimport javax.mail.internet.InternetAddressimport javax.mail.internet.MimeMessagedef senderAddress = "AutoTester@companyname.com"def fromName = "Automation Test"msg.setFrom(new InternetAddress(senderAddress,fromName ))

 

[Jenkins]怎样自定义发出邮件的 From Email Address 和 From Name