Handle unsupported attachment-file-types in EML conversion

Hello,
I want to use the conversion from EML to PDF, with attachments.
In some mails there are unsupported file types in the attachment list, like zip or p7s.
If the converter detects an attachment with an unsupported file type, it just throws an exception and stops the conversion - it doesn’t convert the remaining attachments anymore.
If you have 3 attachements and the first one has an unknown type, the other two attachments aren’t converted as well, even if they are supported types.

I tried to use the ConvertOptionsProvider and set the NoConvertOptions result for unsupported file types, but this doesn’t change the problem.

The perfect solution would be, that the Convert method returns unsupported attachments without any conversion to the document stream and moves on to the next attachment.

1 Like

@JuneTech

We are investigating this scenario. Your investigation ticket ID is CONVERSIONNET-5732. We’ll notify you in case of any update.

@JuneTech

Yes, this could be implemented and we will do it in next version of GroupDocs.Conversion for .NET. We’ll notify you once the release is available.

These are greate news, Thank you for the update.
Then I am looking forward for the next version release!

1 Like

@JuneTech

You’re welcome.

Was this resolved?

Thanks

@BSkoloda

Yes. Please download latest version of the API.

Were would I find an example or documentation on how to use the new feature

@BSkoloda

There is no any code level change in the API for this feature. The change is internal in the API, so now unrecognized filetypes are just returned as they are without any conversion or exception.

I am still getting an error message = Message = “Conversion from () to pdf PDF is not supported.”

GroupDocs.Conversion and GroupDocs.Merger both version 23.4.0

Here is the code for reference:

    public List<MemoryStream> Test ()
    {
        List<MemoryStream> ms = new List<MemoryStream>();
        List<string> issues = new List<string>();
        string fileName = "TestEmail.msg";
        try
        {

            int index = 0;

            var loadOptions = new EmailLoadOptions { ConvertOwned = true, ConvertOwner = true };

            using (Converter converter = new Converter(fileName, () => loadOptions))
            {

                converter.Convert(() => new MemoryStream(), (Stream convertedStream, string sourceFileName) =>
                {
                    ms.Add(new MemoryStream());
                    convertedStream.CopyTo(ms[index++]);

                }, new PdfConvertOptions());

            }
        }
        catch (Exception ex)
        {

            if (ex.Message != null)
            {
                issues.Add("An error occurred during 'ConvertEmail' process for file '" + fileName + "'. Error: '" + ex.Message + "'");
            }
            else
            {
                issues.Add("An error occurred during 'ConvertEmail' process '" + fileName + "'.");
            }

            ms = new List<MemoryStream>();

        }

        return ms;

    }

You can find the file below

TestEmail.zip (36.8 KB)

@BSkoloda

This is a difference issue and it’s already under investigation. The investigation ticket ID is CONVERSIONNET-6041. We’ll notify you in case of any update.

It sounds like the same issue could you explain the difference? Also how do I see the investigation ticket?

@BSkoloda

This particular exception appears when you convert an Email file with PDF attachment. However, API supports PDF file format.

The ticket is created in our internal issue tracking system. You’ll be notified when there’s any progress.

Just to make sure my Email Message doesn’t have a PDF attachment in it. Its signed so it has .p7s file attached I am just trying to convert the email and all attachments of emails to a single PDF file

@BSkoloda

Noted. We are further investigating this behavior of the API.

The issues you have found earlier (filed as CONVERSIONNET-6041) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov

Hi:

I updated the package to version 23.5.0.
I just tried my code again with the same Email Attachment above and now the error message says
‘Could not load file ‘FrLPMKA0qUOx9ksXWjrXpQ’. Specified file is corrupted.’

@BSkoloda

We kindly request you to provide a simplified console application that can reliably reproduce the reported issue. We have attempted to replicate the problem using the provided code and source file, but we were unable to do so. Your cooperation in sharing a reproducible sample will greatly assist us in resolving the issue effectively. Thank you for your understanding.

C# .NET 6 with GroupDocs.Conversion 23.5.0 and GroupDocs.Merger 23.5.0Program.zip (739 Bytes)
and here is the email file I was using TestEmail.zip (36.8 KB) I did realize the error is actually happening on the merger.Save line I have a comment in the catch code Thanks!

1 Like

@BSkoloda

Thanks for the details. We will continue our investigations as per the provided details and notify you in case of any update.

Your investigation ticket ID is MERGERNET-1465.