跪求INDY10中idpop3和IdSSLIOHandlerSocketOpenSSL使用SSL连接Gmail用法
郁闷3天了, 就是不知道咋弄,网上该搜的都搜索了.
// 指定新邮件的地址等信息 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); }
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;