簡體   English   中英

為什么將郵件內容發送到Hotmail帳戶時將其作為附件發送?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM