简体   繁体   中英

How to unzip the zip attachment from email using Lumisoft.net

I am using Lumisoft for process file attached in an email. Suppose if there is .txt or .pdf as attachment in email then I can process it But is it possible to process on Zip attachment.

I mean I want to extract zip and process on file(.rpt).

Is this possible using Lumisoft.net

Once you have retrieved the zipped attachment using Lumisoft you could use the .net 4.5 System.IO.Compression to unzip it and then process it as you usually do.

This is a simplified snippet from a project I am currently working on:

using (ZipArchive archive = ZipFile.OpenRead(filePath))
{
    foreach (ZipArchiveEntry entry in archive.Entries)
    {
          // filter archive content if necessary
          if (entry.FullName.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
          {
                var extractPath = Path.Combine("Attachments", entry.FullName);
                entry.ExtractToFile(extractPath, true);

                // Process file
                DoSomethingWithTheFile(extractPath);
          }
    }
}

转到此处 ,有一个提取eml文件的好例子,其逻辑与您要执行的操作相同。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM