[英]why the reply mail is sent as attachment when I send it to outlook account using javamail?
[英]why mail content is sent as attachment when I send it to Hotmail account?
为什么将邮件内容发送到Hotmail帐户时将其作为附件发送?
当我将邮件发送到Hotmail帐户时,邮件正文将作为附件发送。 但是,当发送到其他帐户(例如yahoomail,gmail)时,它不会造成任何问题。
我想知道为什么Hotmail帐户出现问题。
请给我一个解决方案。
MimeMessage msg = createMimeMessage(sender,emsg,session,mail.companyName); Transport.send(msg);
Multipart multipart = new MimeMultipart();
//这是模板附件部分
如果(emsg.getAttachment()!= null){
对于(文件文件:emsg.getAttachment()){
MimeBodyPart messageAttachmentBodyPart =新的MimeBodyPart(); messageAttachmentBodyPart =新的MimeBodyPart();
DataSource源=新的FileDataSource(file);
messageAttachmentBodyPart.setDataHandler(new DataHandler(source)); messageAttachmentBodyPart.setFileName(file.getName()); multipart.addBodyPart(messageAttachmentBodyPart); }}
对。 因此,如果您将文件从gmail帐户发送到hotmail帐户,会出现附件怎么办? 还是按照您想要的方式显示? 我的猜测是,附加文件是一种安全措施,可以防止恶意代码在显示时被激活。 这种机制也可能是选择性的,这意味着它取决于发件人(有关此问题的一个有趣的帖子就是this )。
另一个想法:为什么这仍然是一个问题?
如果您添加,可能会有所帮助
messageAttachmentBodyPart.setDisposition(Part.INLINE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.