JavaMail - javax.mail.MessagingException 解决java邮件有时候发送失败的错误

时间:2022-12-03 18:08:56

错误信息:

javax.mail.MessagingException: [EOF]

        at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)
        at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1512)
        at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1321)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:637)
        at javax.mail.Transport.send0(Transport.java:189)
        at javax.mail.Transport.send(Transport.java:118)
......


最后终于在*上找到解决方案:

需要多添加配置信息:

props.put("mail.smtp.starttls.enable", "true");

原文链接:

http://*.com/questions/12306685/javamail-javax-mail-messagingexception