Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
如果您在文本编辑器中打开 .MSG 文件,我相信您会发现您要查找的信息以纯文本形式存储在文件内。 (至少在我检查过的所有消息上)
编写一些代码来解析文件以查找以“From:”或“To:”等开头的行,然后提取所需的信息将非常容易。
如果您还需要电子邮件正文,那可能会更复杂一些。
If you open the .MSG file in a text editor, i believe you will find that the information you are after is stored as plain text inside the file. (It is on all the messages i have checked at least)
It would be pretty easy to write some code to parse the file looking for lines beginning with "From:" or "To:" etc. and then extracting the information you need.
If you need the body of the email as well, that may be a bit more complicated.
您可以尝试我们的(商业)Rebex Secure Mail 库。 它可以读取 Outlooks MSG 格式。 以下代码显示了如何操作:
有关发送和接收日期以及它们在消息中如何表示的更多信息,请访问 http://forum.rebex.net/questions/816/extract-senttime-receivetime-and-time-zones
You can try our (commercial) Rebex Secure Mail library. It can read Outlooks MSG format. Following code shows how:
More info on Sent and Received dates and how are they represented in the message can be found at http://forum.rebex.net/questions/816/extract-senttime-receivetime-and-time-zones
Microsoft 已对此进行了记录:.MSG 文件格式规范
Microsoft has documented this: .MSG File Format Specification
这是一个“结构化存储”文档。 我过去曾成功地使用 Andrew Peace 的代码 来阅读这些内容,甚至在 .NET 下(使用 C++/CLI)——它很干净并且相当容易理解。 基本上,您需要弄清楚您需要哪些记录,并查询这些记录 - 这有点麻烦,因为不同版本的 Outlook 和不同类型的消息将导致不同的记录...
It's a "Structured Storage" document. I've successfully used Andrew Peace's code to read these in the past, even under .NET (using C++/CLI) - it's clean and fairly easy to understand. Basically, you need to figure out which records you need, and query for those - it gets a little bit hairy, since different versions of Outlook and different types of messages will result in different records...
以下是 Huseyint 找到的一些使用 Outlook Redemption 的示例 VBA 代码。
Here's some sample VBA code using Outlook Redemption that Huseyint found.
CodeProject 上提供了无需 COM 即可读取 .msg 文件的代码。 请参阅此处。
There is code avaliable on CodeProject for reading .msg files without COM. See here.
更新:我发现了一个名为 Outlook Redemption 的第三方 COM 库,它是目前对我来说工作得很好。 如果您通过 .NET 中的 COM-Interop 使用它,请不要忘记在使用完每个 COM 对象后释放它,否则您的应用程序会随机崩溃。
Update: I have found a 3rd party COM library called Outlook Redemption which is working fine for me at the moment. If you use it via COM-Interop in .NET, don't forget to release every COM object after you are done with it, otherwise your application crashes randomly.