我正在尝试使用Limilabs imap库连接到电子邮件;

  tcpc = new System.Net.Sockets.TcpClient("imap.gmail.com", 993);


工作良好 ;而limilabs imap没有

using (Imap imap = new Imap())
{
    imap.Connect("imap.gmail.com", 993);


给出异常:

Limilabs.Client.ServerException was unhandled
  HResult=-2146233088
  Message=Tried to read a line. No data received. Please make sure that antivirus and firewall software are disabled or configured correctly.
  Source=Mail
  StackTrace:
       at   .()
       at   .(MemoryStream )
       at   .()
       at Limilabs.Client.IMAP.ImapResponse.(Stream )
       at Limilabs.Client.IMAP.Imap.(ImapResponse )
       at Limilabs.Client.IMAP.Imap.(String , Boolean )
       at Limilabs.Client.IMAP.Imap.ReceiveResponse(String tag)
       at Limilabs.Client.IMAP.Imap.wqf45mzzsju7786nbrb2h8aclqm8jmnx    ()
       at Limilabs.Client.ClientBase.Connect(String host, Int32 port, Boolean useSSL)
       at Limilabs.Client.ClientBase.Connect(String host, Int32 port)
       at ConsoleIMAP.Program.Main(String[] args) in c:\users\hmohamed\WcfServiceLibrary1\ConsoleIMP\Program.cs:line 136
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:
       HResult=-2146233088
       Message=Tried to read a line. No data received.
       Source=Mail
       StackTrace:
            at   .()
       InnerException:

最佳答案

Limilabs imap.Connect具有重载以指定是否要使用SSL。它不会从您指定的端口推断出它。您也可以使用imap.ConnectSSL方法。

有关更多信息,请参见:
http://www.limilabs.com/blog/use-ssl-with-imap

关于imap - Limilabs IMAP异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26452999/

10-11 22:05
查看更多