简体   繁体   English

在C#中验证EML文件

[英]Validating EML files in C#

In my application, I need to validate if a particular file has a correct EML format. 在我的应用程序中,我需要验证特定文件是否具有正确的EML格式。 I thought about opening the file and check if it has the correct headers (subject,body,etc) but I'd like to know if there is a standard approach for this in C#. 我考虑过打开文件并检查它是否具有正确的标题(主题,正文等),但是我想知道在C#中是否对此具有标准方法。

For the record, the file could end with any possible extension and I don't intend to do anything special with the file, I just need to verify that the file is in a valid EML format. 作为记录,该文件可以以任何可能的扩展名结尾,并且我不打算对该文件做任何特殊的事情,我只需要验证该文件是否为有效的EML格式即可。

Easily Retrieve Email Information from .EML Files 从.EML文件轻松检索电子邮件信息

Here it is in a wrapper class, all nice and tidy. 它在包装器类中,都很整洁。 This comes in real handy if you have a service that needs information that is emailed to the box. 如果您的服务需要通过电子邮件发送到邮箱的信息,这将非常方便。 It has the usual "To", "CC" fields, along with a collection of x-receiver and many other fields. 它具有通常的“ To”,“ CC”字段,以及x接收器和许多其他字段的集合。 It will give you both plain text and HTML bodies, provided they are in the EML. 如果它们在EML中,它将为您提供纯文本和HTML正文。 Dates are converted to DateTime. 日期将转换为DateTime。

http://www.codeproject.com/Articles/29439/Easily-Retrieve-Email-Information-from-EML-Files http://www.codeproject.com/Articles/29439/Easily-Retrieve-Email-Information-from-EML-Files

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

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