zoukankan      html  css  js  c++  java
  • C#结合LumiSoft.Net.dll读取Outlook邮件(.eml格式邮件)

    如果直接从Outlook(或者微软的其它邮件客户端如:Outlook Express、Windows Live Mail)的邮件文件(.eml格式)中提取各种电子邮件内容,使用LumiSoft.Net.dll(下载地址:http://www.lumisoft.ee/lsWWW/Download/Downloads/Net/)是一个不错的方法。

    见下面的代码,很简单的代码,提取test.eml文件,分别提取了标题、发送地址、内容和发送日期。如果需要提取一个邮件的多个内容,可以根据智能感知参考;提取多个邮件,用一个遍历的办法即可完成。

    using System;
    using LumiSoft.Net.Mime;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                  Parse();
                 Console.ReadKey();
    
            }
    
            //use LumiSoft.Net.dll, can read all info of email from .eml file
            public static void Parse()
            {
                     Mime m = Mime.Parse("E:\test.eml");
                     MimeEntity[] entity = m.MimeEntities;
                     var subject = entity[0].Subject.ToString();
                     var from = entity[0].From.ToAddressListString();
                     var body = m.BodyHtml;
                    //var body = entity[1].DataText;
                    var addedDate = entity[0].Date;
                
            }
        }
    }
  • 相关阅读:
    bootstrap 兼容 IE8
    在IE8的基础上安装IE11
    前台
    dll 库文件下载地址
    年轻
    linux 异常
    Navicat断网时连不上数据库
    jQuery
    破解版 Teamver 安装
    mysql
  • 原文地址:https://www.cnblogs.com/wusir/p/3564428.html
Copyright © 2011-2022 走看看