Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
199 stars 55 forks source link

Attached excel file from stream is corrupted #120

Closed attilaszivos closed 6 months ago

attilaszivos commented 7 months ago

I use SQL Report server to generate XLS report. Server returns the result as byte array. I create a MemoryStreamfrom the byte array like this: MemoryStream stream = new MemoryStream(byteArray);

I add this stream as attachment but I cannot open the attachment in the generated email. Excel says the file is corrupted.

email.Attachments.Add(attachment.Stream, attachment.FileName);

The report result is valid, if I write it into a file then Excel can open the file without any issue.

Sicos1977 commented 7 months ago

Without an example file I can say nothing about this... please post an example MSG file or if you don't want to post it here then sent it to sicos2002@hotmail.com ... please ZIP the file before sending it.