Hello Aspose Support Team,
we use Aspose to extract attachments from the EML files.
We use Mail for Java 2.3.0 library to access attachments within of an EML mail.
The issue we’ve found is, that by some EML’s attachments have been extracted as txt files containing base64 characters.
To reproduce this use attached test.eml (you need to extract it from the ZIP). If you open it with your web-client, you’ll see it contains 5 PDF attachments. Use it to run this java code and as result in the directory “extracted_attachments”: you’ll find 5 documents, which are stored as PDF, but in fact they are TXT-files with base64 stream.
>>>>>
InputStream readerInputStream = new FileInputStream(new File("./test.eml"));
MailMessage message = MailMessage.load(readerInputStream,
MessageFormat.getEml());
//Extract attachments
AttachmentCollection attachments = message.getAttachments();
if (attachments!=null && attachments.size()==0) {
File attachmentsDir = new File("./output/extracted_attachments");
attachmentsDir.mkdir();
for (int i = 0; i< attachments.size(); i++) {
Attachment attachment = (Attachment)attachments.get(i);
String attachmentDestination = "./output/extracted_attachments/" + attachment.getName();
attachment.save(attachmentDestination);
}
}
>>>>>
This issue is very urgent and critical for us, because we need the fix for an important customer presentation.
Thanks in advance for your help!
Best regards
Vitali