Java Don';我不想将图像作为附件,但需要将其内联
我有这段代码使用Java在电子邮件中包含图像Java Don';我不想将图像作为附件,但需要将其内联,java,email,Java,Email,我有这段代码使用Java在电子邮件中包含图像 MimeBodyPart messageBodyPart = new MimeBodyPart(); DataSource imageSource = new ByteArrayDataSource(imageToByteArray(image, format), type); messageBodyPart.setDataHandler(new DataHandler(imageSource)); messageBodyPart.setConten
MimeBodyPart messageBodyPart = new MimeBodyPart();
DataSource imageSource = new ByteArrayDataSource(imageToByteArray(image, format), type);
messageBodyPart.setDataHandler(new DataHandler(imageSource));
messageBodyPart.setContentID(imageContentID);
multipart.addBodyPart(messageBodyPart);
但我的图像显示为附件和内联。有什么问题吗?两件事: