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

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

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

脚本如下:

import javax.mail.Message.RecipientType

import javax.mail.Address

import javax.mail.internet.InternetAddress

import javax.mail.internet.MimeMessage



def senderAddress = "[email protected]"

def fromName = "Automation Test"

msg.setFrom(new InternetAddress(senderAddress,fromName ))

 

你可能感兴趣的:(Jenkins)