Reputation: 2679
I'm parsing/extracting data from eml
files using javax.mail.internet.MimeMessage
.
MultiPart multiPart =
(MultiPart)MimeMessage.getContent();
...//check if attachments are present, then extract it
MimeBodyPart part = (MimeBodyPart)multiPart.getBodyPart(attachmentIndex);
String fileName = part.getFileName();
The file name always prints null. How do I know the attachment filename and extension? Without at least knowing the extension, I can't even save the file properly.
Basically, I'm looking for a generic Java library API which parses eml
files and gives message text and attachments (recursively?).
Upvotes: 0
Views: 1127
Reputation: 29971
Attachments aren't required to have a filename.
If your EML file is in MIME format and contains a file name, but JavaMail isn't finding it, post an example.
Upvotes: 1