我想在 javamail imap 中获取邮件嵌入图像。怎么做?仅将图像保存为本地(D:\),然后在邮件客户端中替换其路径?输入流好吗?有什么建议吗?谢谢先进。
FileOutputStream fos = new FileOutputStream("d:\\"
+ part.getFileName());
InputStream in = part.getInputStream();
byte[] by = new byte[8192];
int x = 0;
System.out.println(x);
while ((x = in.read(by)) != -1) {
fos.write(by);
}
fos.flush();
fos.close();
temp = temp + 1;
tempname = tempname + part.getFileName() + "~-";