开发者

Replace CDO & ADODB, email message file parsing

I use c# code below to open email message file (eml) and parse subject and body(need to parse eml file and find all web links in any). I have searched for native c# code to open textual or html formatted e-mail message files as plain text without any luck, so I decided to use ADODB and CDO COM objects for my solution. The problem is that this code do not work on Windows 2008 Standard (not R2) and I need to replace it with other code. Maybe someone could suggest any solution?

CDO.Message msg = new CDO.MessageClass();
ADODB.Stream stream = new ADODB.Stream开发者_运维问答Class();
stream.Open(Type.Missing, ADODB.ConnectModeEnum.adModeUnknown, ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, String.Empty, String.Empty);
stream.LoadFromFile("c:\test.eml");
stream.Flush();
msg.DataSource.OpenObject(stream, "_Stream");
msg.DataSource.Save();

string texBody = msg.TextBody;
string textSubject = msg.Subject;
string from = msg.From;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜