Spire.Email for .NET is a professional .NET Email library specially designed for developers to create, read and manipulate emails from any .NET (C#, VB.NET, ASP.NET) platform with fast and high quality performance.

Tue Mar 30, 2021 10:34 am

Hi..I'm using spire email 4.1.2 and I'm working on extract attachment from a msg file. The problem that I facing now is if the attachment is a msg file, after the extraction it become an invalid file because of the return attach.ContentType.Name is the filename without the extension, for other attachment such as pdf it return a filename with extension. Is there anyway that I can extract the msg attachment correctly?
https://imgur.com/a/5cFfi8Q

Code: Select all
mail = MailMessage.Load(file);

foreach (Attachment attach in mail.Attachments)
{
       var target = path + Path.DirectorySeparatorChar + attach.ContentType.Name;
       fs = File.Create(target);
       attach.Data.CopyTo(fs);
       fs.Dispose();
}


Here I also attached a sample file for you to test out.

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Wed Mar 31, 2021 9:41 am

Hello,

Thanks for your inquiry.
I did an initial test with the latest Spire.Email Pack Version:4.1 and did reproduce your issue. I have logged this issue in our bug tracking system with the ticket SPIREEMAIL-42. If there is any update, we will inform you immediately. Sorry for the inconvenience caused.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Fri May 06, 2022 10:05 am

Hello,

Glad to inform that we just released Spire.Email Pack(hot fix) Version:5.5.0 which fixed SPIREEMAIL-42, you can download it from the following links to test.
Website link: https://www.e-iceblue.com/Download/email-for-net.html
Nuget link: https://www.nuget.org/packages/Spire.Email/5.5.0

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.Email