Creation of a EML file with an attachment using JavaMail [closed]

让人想犯罪 __ 提交于 2019-12-04 17:39:29
LarryF

You should try adding the header lines I mentioned to the very top of the message and see how Outlook deals with it then. Add a To:, From:, Subject: and maybe even a Date: with real data in them, and Outlook is more likely to treat it as a message, rather that just a file.

LarryF

Zubi, it looks like the issue is the content type on the attachment is set to "application/octet-stream". So, it looks like the mail reader is taking the PDF file as an alternate display for the "text" body of the message which does not exist, (it's just blank).

You'll have to forgive me, it's been more than a year since I've dealt with Mime, but I think you are going to want to A) Put some body text in the message, B) Make sure the type on the attachment is set to application/pdf. Hopefully, this will prevent the mail reading from trying to display the PDF as the primary body of the message.

Other than that, it looks normal... Now, Outlook MIGHT bitch because there are no RFC 822 headers in the main body. You may want to add at LEAST a From:, To:, and a Subject:.

The message passed MY MIME parsing code...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!