简体   繁体   English

从原始.eml文件中解析和提取HTML和文本消息

[英]Parsing and extracting HTML and Text messages from raw .eml file

I did this before, but the source codes were in a flash memory which one failed. 我之前做过这个,但源代码是在闪存中,其中一个失败了。 So I'm rewriting the project. 所以我正在改写这个项目。 I've got archived .eml files on disk and I need to extract HTML message if any. 我已经在磁盘上存档了.eml文件,我需要提取HTML消息(如果有的话)。 If not, I'll extract text message. 如果没有,我将提取短信。

I don't remember what 3rd party used before. 我不记得第三方之前使用过什么。 But parsing was so easy like below: 但解析很容易,如下所示:

 oMessage.Raw = LoadFile(fileEml);
 msgHTML = oMessage.HTML;
 msgText = oMessage.Text;

Can anyone recognize that 3rd party library? 谁能认出第三方图书馆?

I don't know what parsing library you were using before, but the best parser out there right now is MimeKit . 我不知道你之前使用的是什么解析库,但是现在最好的解析器是MimeKit It's significantly faster and more RFC-compliant than any other parser. 它比任何其他解析器都快得多,并且更符合RFC。

I'm also working on a mail client library (SMTP, POP3 and IMAP) called MailKit . 我还在研究一个名为MailKit的邮件客户端库(SMTP,POP3和IMAP)。

(Disclosure: I wrote MimeKit and MailKit after spending time looking at all of the Open Source alternatives out there and finding that all of them were really bad, and often the authors of said libraries blamed the other mail software when it was a bug in their own code and they would have realized that if they actually bothered to read the RFCs.) (披露:我写了MimeKit和MailKit后花了很长时间查看所有的开源替代品并发现所有这些都非常糟糕,并且这些库的作者经常指责其他邮件软件,因为它们是他们的错误自己的代码,他们会意识到,如果他们真的打扰阅读RFC。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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