Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

JavaMail 使用 网易163邮箱,发送时 异常:554 DT:SPM,加了抄送人也没用

主代码逻辑如下

@Async
protected void sendMail(String title, String content, String email) {
    try {
        MimeMessage message = mailSender.createMimeMessage();
 //设置抄送人(发件人邮箱,不然当作垃圾邮箱处理,发不出去)
 message.addRecipients(MimeMessage.RecipientType.CC, InternetAddress.parse(sender));
 MimeMessageHelper helper = new MimeMessageHelper(message, true,"utf-8");
 helper.setFrom(sender);// 发送人的邮箱
 helper.setSubject(title); //标题
 helper.setTo(email); //发给谁  对方邮箱
 helper.setText(content, true); //内容,true支持html内容,false支持纯文本内容
 mailSender.send(message); //发送
 } catch (Exception e) {
        e.printStackTrace();
 }
}
一开始没有加抄送人,发不出去,加了抄送人之后,发出去了一次,然后就中午吃饭了,回来休息了之后,再试一下,又发送不出去了,这下就不知道原因,有没有哪位大佬知道啥原因啊,感激不尽

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你这个邮件发送触发了 163 那边的垃圾邮件拦截. 你是不是大量发送了内容相近的邮件啊. 这种情况下,不管是发信方服务还是收信方的服务,都会拦截的.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...