从电子邮件标头中提取信息

时间:2012-03-14 11:14:05

标签: c# database email text

我正在用C#创建一个应用程序,其中一部分涉及处理电子邮件。我在文本文件中包含所有电子邮件。从这些,我想隔离Sender,Subject,Body等,并希望将其存储在数据库中。例如

Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!noc.near.net!howland.reston.ans.net!gatech!pitt.edu!alpha.smi.med.pitt.edu!fmg
From: fmg@alpha.smi.med.pitt.edu (Filip Gieszczykiewicz)
Newsgroups: sci.electronics
Subject: FAQ - corrections
Summary: PCB correction, FTP site, etc
Message-ID: <8971@blue.cis.pitt.edu>
Date: 15 Apr 93 16:30:42 GMT
Sender: news+@pitt.edu
Followup-To: poster
Organization: Medical Informatics, Pittsburgh, PA USA
Lines: 29

Greetings. I received a reply stating that unless someone else
confirms that the following company is operating, I should remove it from my lst:PCB Prototypes of Sandy, UT
Ronald Baker 8195 South 2660 East
Sandy, UT  84093
Tel: [read below]

This is from the COMM_PCB.FAQ (commercial PCB makers).
Also, I don't have time to get the FAQ onto the sci.answers because of what I like to refer to is "red tape" - after the finals, I'll see what I can do... in the mean-time, anyone know of an FTP site that wouldn't mind a 250K file? :-)

所以从这封电子邮件中,我想挑选字段 - &gt; From,subject,sender和实际正文并将其存储在我的数据库中。我希望在C#中使用它。谢谢你的帮助

1 个答案:

答案 0 :(得分:1)

StackOverflow上有一个类似的问题here,他们使用正则表达式解析。