import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import com.eviware.soapui.support.types.StringToStringMap;
import javax.mail.*;
class SendMailTLS{
public void sendMail(String statusCode){
final String username="*********@qq.com";
final String password="*********";//发送邮箱的密码,即开启smtp服务得到的授权码。注:不是QQ密码。
Properties props=new Properties();
props.put("mail.smtp.auth","true");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.host","smtp.qq.com");//QQ邮箱的smtp服务器地址
props.put("mail.smtp.port","25");
Session session=Session.getInstance(props,
new javax.mail.Authenticator(){
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication(username,password);
}
});
try {
Message message=new MimeMessage(session);
message.setFrom(new InternetAddress
[SoapUI]groovy实现邮件发送
最新推荐文章于 2021-02-15 22:02:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)