首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

跪求INDY10中idpop3和IdSSLIOHandlerSocketOpenSSL使用SSL连接Gmail用法,该怎么解决

2012-02-11 
跪求INDY10中idpop3和IdSSLIOHandlerSocketOpenSSL使用SSL连接Gmail用法郁闷3天了, 就是不知道咋弄,网上该

跪求INDY10中idpop3和IdSSLIOHandlerSocketOpenSSL使用SSL连接Gmail用法
郁闷3天了, 就是不知道咋弄,网上该搜的都搜索了.

C/C++ code
 // 指定新邮件的地址等信息    IdSSLIOHandlerSocketOpenSSL1->SSLOptions->Method = sslvTLSv1;    //IdSSLIOHandlerSocketOpenSSL1->Destination = "pop.gmail.com:995";   // IdSSLIOHandlerSocketOpenSSL1->SSLOptions->Mode = sslmClient;    //IdSSLIOHandlerSocketOpenSSL1->SSLOptions->VerifyDepth = 0;   //IdSSLIOHandlerSocketOpenSSL1->RecvBufferSize = 1024;    IdSSLIOHandlerSocketOpenSSL1->Host = "pop.gmail.com";   // IdSSLIOHandlerSocketOpenSSL1->Port = 995;    POP->Host = "pop.gmail.com";    POP->Port = "995"    POP->Username = "username";    POP->Password = "password";    POP->UseTLS = utNoTLSSupport;    POP->IOHandler = IdSSLIOHandlerSocketOpenSSL1;    POP->ConnectTimeout = 10000;    try    {        POP->Connect();    }    catch( EIdException &e )    {         Memo1->Lines->Add("连接错误: " + e.Message);    }


结果是: 
连接状态:Connected.
连接中...
连接错误: Connection Closed Gracefully.

每次都是Connection Closed Gracefully. 怎样设置属性啊??是否需要SSL证书才能连接?只有98分,全送了.



[解决办法]

[解决办法]
Indy10的具体版本号是多少?
[解决办法]
我是用Delphi测试的:
Delphi(Pascal) code
var  popMsg: TIdPOP3;  sslConn: TIdSSLIOHandlerSocketOpenSSL;begin  sslConn := TIdSSLIOHandlerSocketOpenSSL.Create(Nil);  try    popMsg := TIdPOP3.Create(Nil);    try      popMsg.IOHandler := sslConn;      popMsg.Host := 'pop.gmail.com';      popMsg.Port := 995;      popMsg.Username := 'MyGMailUserName@gmail.com';      popMsg.Password := '********';      popMsg.UseTLS := utUseImplicitTLS;      popMsg.Connect;      ShowMessage('MessageCount:'+IntToStr(popMsg.CheckMessages));    finally      popMsg.Free;    end;  finally    sslConn.Free;  end;end; 

热点排行