We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Not supported error converting emails to PNG in .NET

Converting emails to PNG for thumbnail creation results in a “File type not supported” exception.
I analyzed the problem and found out, that GroupDocs.Conversion 22.1 attempts to convert the ZIP attachment of the email.

Attachment test 6 ZIP.zip (49.2 KB)

This problem seems to be new with version 22.1.

var emailLoadOptions = new EmailLoadOptions();
emailLoadOptions.ResourceLoadingTimeout = TimeSpan.FromSeconds(10);
//emailLoadOptions.ConvertOwned = false;

var imgOptions = new ImageConvertOptions()
{
	Format = FileTypes.ImageFileType.Png,
	//convert only the first page for thumbnail
	PageNumber = 1,
	PagesCount = 1,
	Width = 256,
};

using (var conv = new Converter(documentPath, () => emailLoadOptions))
{
	string filePath = @"outputConversion{0}.png";
	Contracts.SavePageStream getPageStream = page => new FileStream(string.Format(filePath, page), FileMode.Create);
	conv.Convert(getPageStream, imgOptions);
}

As a workaround, I set ConvertOwned to false.
This should not be needed though, as I only want to convert the first page anyway.

1 Like

@Clemens_Pestuka

When converting the provided Email (e.g. MSG) file to PNG, we got the same exception. Therefore, we’ve logged it in our internal issue tracking system with ID CONVERSIONNET-5099. We’ll now further investigate how the Email attachments (e.g. ZIP) could be handled at the time of document conversion.

1 Like