Retrieve Email Information from .EML Files

前端 未结 1 1655
挽巷
挽巷 2021-01-02 20:53

I have a .eml files. What I want to do is to retrieve the From, To, Subject, Body & attachments(if any) from this .eml file and save to database. I need to do that in C

1条回答
  •  时光说笑
    2021-01-02 21:50

    Refer Following link urgently:

    http://www.codeproject.com/Articles/76607/Easily-Retrieve-Email-Information-from-EML-Files-R

    protected CDO.Message ReadMessage(String emlFileName)
    {
        CDO.Message msg = new CDO.MessageClass();
        ADODB.Stream stream = new ADODB.StreamClass();
        stream.Open(Type.Missing, ADODB.ConnectModeEnum.adModeUnknown, ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, String.Empty, String.Empty);
        stream.LoadFromFile(emlFileName);
        stream.Flush();
        msg.DataSource.OpenObject(stream, "_Stream");
        msg.DataSource.Save();
        return msg;
    }
    

    You can also get help for elm parsing from:

    http://blog.onderweg.eu/2010/12/parsing-eml-files-in-c/

    This is also useful tutorial:

    http://www.emailarchitect.net/eagetmail/kb/csharp.aspx?cat=18

    0 讨论(0)
提交回复
热议问题