解析电子邮件时出现异常 "Media Type must be in the format type "/" subtype Parameter name: mediaType"

While parsing email Getting exception "Media Type must be in the format type "/" subtype Parameter name: mediaType"

我的项目通过 OpenPop library 解析电子邮件。 每次来自特定发件人的邮件未解析并出现以下异常

Message: Media Type must be in the format type "/" subtype Parameter name: mediaType Source: OpenPop TargetSite: System.String cleanMediaType(System.String) StackTrace: at OpenPop.Mime.Header.HeaderFieldParser.cleanMediaType(String mediaType) at OpenPop.Mime.Header.HeaderFieldParser.ParseContentType(String headerValue) at OpenPop.Mime.Header.MessageHeader.ParseHeader(String headerName, String headerValue) at OpenPop.Mime.Header.MessageHeader.ParseHeaders(NameValueCollection headers) at OpenPop.Mime.Header.MessageHeader..ctor(NameValueCollection headers, IParsingErrorHandler parsingErrorHandler) at OpenPop.Mime.Header.HeaderExtractor.ExtractHeadersAndBody(Byte[] fullRawMessage, MessageHeader& headers, Byte[]& body, IParsingErrorHandler parsingErrorHandler) at OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody) at OpenPop.Mime.MessagePart.ParseBody(Byte[] rawBody) at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers, IParsingErrorHandler parsingErrorHandler) at

Openpop 代码在这里

跟随 class 抛出异常

问题是

如何处理这个异常?

或者是否有新版本的 OpenPop 进行了此修复?

问题是

How can I handle this exception?

  • 不需要处理异常,因为我想解析和下载电子邮件。所以我需要更改 OpenPop.dll 的 code.I 下载代码,稍作改动我就可以解析电子邮件

Or Is there any New version of OpenPop with this fix?

  • 不,我使用的是最新版本。