Getting System.Drawing.Image.FromStream error while creating MapiMessage (C# .NET)

Hello there ,

When i have data in memory stream which i am lo loading to mailmessage…but after successfully loading/creating MailMessage when i try to create MapiMessage object then i am getting error for some mails : “System.Drawing.Image.FromStream” at Aspose.Email.Mapi.MapiMessage.FromMailMessage(MailMessage message)

Note: I am Using Aspose.Email 20.3

@Shital_diwate

Can you please try using latest Aspose.Email for .NET 20.8. In case there is still an issue then please share the working sample project reproducing the issue on your end.

I tried with updated aspose but issue is still remain the same.

Below is the sample code:
MemoryStream memoryStream = new MemoryStream(decodedByte);
MailMessage AsposeMessageObj = MailMessage.Load(memoryStream);
MapiMessage mailobject = MapiMessage.FromMailMessage(AsposeMessageObj);

@Shital_diwate

Please provide the source file that is failing on your end so that we may verify that.

Sampleseml.zip (145.0 KB)
here are the samples for which i am facing issue

@Shital_diwate

Using following sample code, I have not found any issue while loading the 5 EML files shared by you. Can you please try using the latest Aspose.Email for .NET 20.8 on your end and if there is still an issue then please share the working sample project reproducing the issue.

        public static void TestEmailLoad()
        {
            try {
                String path = @"C:\Users\mudas\Downloads\Sampleseml\";

                var decodedByte = File.ReadAllBytes(path + "Sample4.eml");
                MemoryStream memoryStream = new MemoryStream(decodedByte);
                MailMessage AsposeMessageObj = MailMessage.Load(memoryStream);
                MapiMessage mailobject = MapiMessage.FromMailMessage(AsposeMessageObj);
                int s = 9;
            }
            catch(Exception e)
            {
                String s = e.StackTrace;
            }
            
        }

i have tried using updated aspose already, its not workig. still face same issue.
and above mails are getting fail at my end with error System.Drawing.Image.FromStream when i put entire file which have 2 lack items. i can not share entire file with u.

@Shital_diwate

Since, I am unable to reproduce the issue using the shared code for the files that you have provided therefore, I request you to please share the sample Visual Studio Project along with actual files reproducing the issue so that we may investigate it further.

PS: We have also rolled out Aspose.Email for .NET 20.9 today and you may please try that too.

Hi muddassir,
am still facing this issue for different mail sample. could you please help me out with solution, i have client waiting on urgent basis

@Shital_diwate

As requested earlier, please share the information below with us.