本文介绍了我如何连接imap.gmail.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想将imap.gmail.com与ssl连接时,它在sslStream.AuthenticateAsClient(imap.gmail.com)中无效,程序在这里停止。



这是我的代码:



When I want to connect the imap.gmail.com with ssl, It did not work in sslStream.AuthenticateAsClient("imap.gmail.com") , The program stop here.

Here is my code:

var m_oImapServ = new TcpClient("imap.gmail.com", "995");

var sslStrm = new SslStream(m_oImapServ.GetStream(),false);

    sslStrm.ReadTimeout = 30000;
    try
        {
            ((SslStream)sslStrm).AuthenticateAsClient("imap.gmail.com");

         }
     catch (AuthenticationException e)
          {
             Console.WriteLine("Exception: {0}", e.Message);
             if (e.InnerException != null)
                 {
                    Console.WriteLine("Inner exception: {0}", e.InnerException.Message);
                  }
                   Console.WriteLine("Authentication failed - closing the connection.");
                   m_oImapServ.Close();
                   return ImapResponseEnum.IMAP_FAILURE_RESPONSE;
                  }

      m_oNetStrm = (Stream) sslStrm;
     m_oRdStrm = new StreamReader(sslStrm);





As客户方需要求职吗?有谁能够帮我?非常感谢。



As client side need a cetification? Can anybody help me? thanks a lot.

推荐答案


这篇关于我如何连接imap.gmail.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:49