سؤال

I've stored individual messages as .eml files on my disk. When it comes time to read them out of disk and into memory, I'm having trouble recovering the body (text) of the email. Here's the code for reading the .eml file

String filePath = "filepath\\msg0.eml";
InputStream is = new FileInputStream(filePath);
MimeMessage mime = new MimeMessage(null, is);

Here's the interesting thing -- I can print out various things about the email, who it's from, the subject line, the time it was received, cc, bcc, etc. I just can't get to the email content. Where I should see the body text, instead there is a memory address (below)

content type: multipart/alternative; boundary="00032555717a714a1504a378be8e"

so any help? Am I forgetting something as simple as a cast? I've tried printing the content from a Multipart and a Message in addition to the MimeMessage format. Your input is appreciated, thanks!

هل كانت مفيدة؟

المحلول

Use the msgshow.java demo program that comes with JavaMail to display the message in the file. Use the -m option. If it doesn't show what you expect, then the file format is wrong and you should look at the program that stores the message in the file.

If you're still having trouble, we're going to need more details to help you figure out what's wrong.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top