简体   繁体   English

Pop3Client错误:“不支持7位编码名称”

[英]Pop3Client error: “7bit is not supported encoding name”

I have an code that opens my mail box. 我有一个打开邮箱的代码。 This is the code: 这是代码:

private Pop3Client GetPop3Client()
{
        Pop3Client popClient = new Pop3Client();
        popClient.Connect("smtp.xxxxxxxxx.xxxx.xx", 110, false);
        popClient.Authenticate("username", "passowrd");
        return popClient;
}

So, in that line: 因此,在该行中:

Message message = popClient.GetMessage(1);

This error occurs: 发生此错误:

'7bit' is not a supported encoding name. '7bit'不是受支持的编码名称。 Parameter name: name at System.Globalization.EncodingTable.internalGetCodePageFromName(String name) at System.Globalization.EncodingTable.GetCodePageFromName(String name) at OpenPop.Mime.Header.HeaderFieldParser.ParseCharsetToEncoding(String characterSet) at OpenPop.Mime.MessagePart.ParseBodyEncoding(String characterSet) at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers) at OpenPop.Mime.MessagePart.ParseMultiPartBody(Byte[] rawBody) at OpenPop.Mime.MessagePart.ParseBody(Byte[] rawBody) at OpenPop.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers) at OpenPop.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody) at OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber) at DocumentCenter.Repository.ProcessMessage.ReadAllInMailBox() in C:\\dsn\\net\\project\\project.Repository\\ProcessMessage.cs:line 414 参数名称:System.Globalization.EncodingTable.internalGetCodePageFromName(字符串名称)的名称System.Globalization.EncodingTable.GetCodePageFromName(字符串名称)的OpenPop.Mime.Header.HeaderFieldParser.ParseCharsetToEncoding(字符串字符集)的名称位于OpenPop.Mime.MessagePart.ParseBodyEncoding的字符串名称(字符串字符集)位于OpenPop.Mime.MessagePart..ctor(位于OpenPop.Mime.MessagePart.ParseMultiPartBody(字节[] rawBody),位于OpenPop.Mime.MessagePart.ParseBody(字节[] rawBody))在DocumentCenter的OpenPop.Mime.Message..ctor(ByteP]的OpenPop.Mime.MessagePart..ctor(Byte [] rawBody,MessageHeader标头)在文档中心的OpenPop.Pop3.Pop3Client.GetMessage(Int32 messageNumber) C:\\ dsn \\ net \\ project \\ project中的.Repository.ProcessMessage.ReadAllInMailBox()。Repository \\ ProcessMessage.cs:第414行

How to fix it? 如何解决?

Since MailKit ( NuGet package here ) has a similar API to OpenPOP, you might try switching to MailKit instead as it does not have this problem (it properly deals with bad character encoding names when parsing messages). 由于MailKit此处为NuGet软件包 )具有与OpenPOP相似的API,因此您可以尝试改用MailKit,因为它没有此问题(解析邮件时,它可以正确处理错误的字符编码名称)。

If you don't want to change to MailKit, you'll need to edit the source code of OpenPOP and fix OpenPop.Mime.Header.HeaderFieldParser.ParseCharsetToEncoding() to properly handle bad charset names. 如果不想更改为MailKit,则需要编辑OpenPOP的源代码并修复OpenPop.Mime.Header.HeaderFieldParser.ParseCharsetToEncoding()以正确处理错误的字符集名称。

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

相关问题 从pop3client读取邮件时出错 - Error while reading mail from pop3client 编码/解码PDU 7位septets GSM长消息 - Encoding/Decoding PDU 7bit septets GSM long messages 适用于GSM Pdu 7Bit的文本编码,以避免像“Pdu 7Be”这样的字符 - Proper text encoding for GSM Pdu 7Bit to avoid chars like “ 解码具有特殊字符的7Bit内容传输编码消息 - Decoding 7Bit content-transfer-encoding messages with special characters 我可以使用pop3client仅下载最新消息,例如仅下载5条最新消息吗? - Can i use pop3client to download only the newestm essages for example only the 5 newest messages? MailKit:从 Pop3Client class 调用 Authenticate 方法时抛出 Authentication Failed - MailKit: throws Authentication Failed while calling Authenticate method from the Pop3Client class OpenPop.NET:Pop3Client:如何仅获取新电子邮件 - OpenPop.NET : Pop3Client : How to get only the new emails 无法获取编码-错误:“”不是受支持的编码名称 - Can't get encoding - error: “” is not a supported encoding name 从Outlook 7位编码处理电子邮件会在输出中引起有趣的字符 - Processing email from outlook 7bit encoding causes funny characters in output 从c#读取html,''不是受支持的编码名称错误 - read html from c#, '' is not a supported encoding name error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM