Hello Aspose Support Team,
I hope this message finds you well.
I am currently using Aspose.Email for .NET to extract emails and attachments from MBOX files. While this process is working well for most cases, I have encountered an issue with Images and logos in the body of the email.
The problem is that when I extract emails from MBOX file, the images in the body of the emails are not being extracted along with the attachments. In contrast, when I use Aspose.Email for PST extraction, the images in the email body are extracted as separate files, along with other attachments and logos in the signature.
I have attached the one such problematic MBOX file for your reference: signature.zip (209.5 KB)
Here is the code I am currently using for the MBOX extraction:
var mboxLoadOptions = new MboxLoadOptions
{
LeaveOpen = false,
PreferredTextEncoding = Encoding.UTF8
};
var emlLoadOptions = new EmlLoadOptions
{
PreserveEmbeddedMessageFormat = true,
PreserveTnefAttachments = true
};
using (var mbox = MboxStorageReader.CreateReader(Inputfile.Mbox, mboxLoadOptions))
{
foreach (var messageInfo in mbox.EnumerateMessageInfo())
{
var eml = mbox.ExtractMessage(messageInfo.EntryId, emlLoadOptions);
eml.Save("Outputfilename" + ".eml");
GetAttachmentsfromEML(eml);
}
}
void GetAttachmentsfromEML(Aspose.Email.MailMessage eml)
{
if (eml.Attachments.Count() >= 1)
{
foreach (var attachment in eml.Attachments)
{
string filename = SanitizeFilename(attachment.Name);
attachment.Save(filename);
}
}
}