在C#中读取一个mbox文件 [英] Reading an mbox file in C#

查看:196
本文介绍了在C#中读取一个mbox文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的一名工作人员丢失了邮箱,但幸运的是他的电子邮件以mbox格式转储。我需要以某种方式获取mbox文件中的所有信息,并将它们投射到我们的技术支持数据库中(因为它的定制工具没有可用的导入工具)。



I我发现 SharpMimeTools 会分解一条消息,但不允许您重复一堆有一个mbox文件中的消息。



有没有人知道一个体面的解析器是开放的,而不必学习RFC写一个?

解决方案

我不知道任何解析器,但是mbox真的是一个非常简单的格式。一个新的电子邮件从From(From + Space)开始的行开始,空行被附加到每个邮件的末尾。如果在电子邮件本身的一行开始发生From,则会被引用(通过前缀'>')。



另请参见维基百科的主题条目


One of our staff members has lost his mailbox but luckily has a dump of his email in mbox format. I need to somehow get all the messages inside the mbox file and squirt them into our tech support database (as its a custom tool there are no import tools available).

I've found SharpMimeTools which breaks down a message but not allow you to iterate through a bunch of messages in a mbox file.

Does anyone know of a decent parser thats open without having to learn the RFC to write one out?

解决方案

I don't know any parser, but mbox is really a very simple format. A new email begins on lines starting with "From " (From+Space) and an empty line is attached to the end of each mail. Should there be any occurence of "From " at the beginning of a line in the email itself, this is quoted out (by prepending a '>').

Also see Wikipedia's entry on the topic.

这篇关于在C#中读取一个mbox文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆