E.g. Email A has attachments B and C - B is an email with attachments B1 and B2. I’d expect the viewer to show pages A (email body), B (email body), B1 (attachment to B), B2 (attachement to B) and C in that order.
The latest commit (pulled today: commit ID e4284552) doesn’t do it.
Thanks for using GroupDocs.Viewer and posting to our forum.
Would you please also share with us the sample email message containing attachments in the same way you have mentioned above? We shall be looking forward to your response.
You are getting the exception because the attachment Email B - with attachments doesn’t contain the extension (see this). You can try rendering the attachment without extension using one of the following solutions:
foreach (AttachmentBase attach in docinfo.Attachments)
{
using (FileContainer file = htmlHandler.GetFile(attach))
{
//SOLUTION 1: Save file to storage and get pages if you do know file extension
string fileName = ReplaceInvalidFileNameChars(file.FileName + ".msg");
string filePath = Path.Combine(config.StoragePath, fileName);
using (FileStream fs = new FileStream(filePath, FileMode.Create))
file.Stream.CopyTo(fs);
List<PageHtml> pages = htmlHandler.GetPages(fileName);
//SOLUTION 2: Or try get pages from stream
/*
List<PageHtml> pages = htmlHandler.GetPages(file.Stream);
*/
}
}
private static string ReplaceInvalidFileNameChars(string fileName)
{
return string.Join("_", fileName.Split(Path.GetInvalidFileNameChars()));
}
I am afraid that the feature of rendering attachments within the attachment is not implemented in any of our demo applications. However, as soon as we get any updates regarding the implementation of this feature, we shall notify you. We appreciate your patience in this regard.