JavaMail requires an InputStreamSource that creates a fresh stream for every call.
Posted ISaiSai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaMail requires an InputStreamSource that creates a fresh stream for every call.相关的知识,希望对你有一定的参考价值。
邮件增加附件时候,报错JavaMail requires an InputStreamSource that creates a fresh stream for every call.
InputStreamResource inputStreamResource = new InputStreamResource(new URL(url).openStream());
mimeMessageHelper.addAttachment(
"wsktn.docx", inputStreamResource
);
解决方式,使用IOUtils.toByteArray 读取后,ByteArrayResource包装解决此问题
ByteArrayResource byteArrayResource = new ByteArrayResource(IOUtils.toByteArray(new URL(url).openStream()));
mimeMessageHelper.addAttachment(
"wsktn.docx", byteArrayResource
);
以上是关于JavaMail requires an InputStreamSource that creates a fresh stream for every call.的主要内容,如果未能解决你的问题,请参考以下文章
JavaMail requires an InputStreamSource that creates a fresh stream for every call.
“this kernel requires an x86-64 CPU, but only detects an i686 CPU, unable to boot” 问题解决
Minimum number of swaps required to sort an array
This kernel requires an x86-64 CPU, but only detected an i686 CPU.