发送富文本邮件报IO异常是因为代码设置的文件内容中,有图片链接失效,拿不到图片造成的,
解决办法,用BASE64替换图片URL;
String base64Image = "图片的64位码";
byte[] bytes = Base64.getMimeDecoder().decode(base64Image);
DataHandler dataHandler = new DataHandler(
new ByteArrayDataSource(bytes,"application/octet-stream"));
BodyPart imgPart = new MimeBodyPart();
imgPart.setDataHandler(dataHandler);
imgPart.setHeader("Content-ID", "<logo-image>");
imgPart.setHeader("Content-Type", "image/png");
imgPart.setDisposition(MimeBodyPart.INLINE);