使用C ++ Builder读取gmail pop3 [英] read gmail pop3 using c++ builder
问题描述
我想使用c ++ Builder阅读我的Gmail收件箱电子邮件,因此我使用这段代码是从youtube上的视频中获取的,但是在阅读之前,我尝试首先使用按钮中的此代码进行连接。
I want to read my Gmail inbox emails using c++ builder so I use this code I got it from videos on youtube, but before i read i tried to connect first using this code in the button.
MyPoP3
POP3->Host = "pop.gmail.com";
POP3->Port = 995;
POP3->Username = "@gmail.com";
POP3->Password = "my pass";
POP3->Connect();
Memo1->Text = "Number = " + IntToStr(MyPoP3->CheckMessages()) + "\n";
MyPoP3->Disconnect();
,我在短暂的延迟后收到了此错误消息。
and i got this error message after a short delay.
error connection closed gracefully
这是我的第一个时间IAM使用C ++ Builder我只是学习它,所以请为该错误提供任何帮助,因为我找不到适合它的任何资源。
预先感谢。
this my first time iam use c++ builder I just learn it so please any help with that error because I can't find any good resource for it.
Thanks in advance.
推荐答案
该错误消息表示服务器正在关闭其TCP连接的末端。
The error message means the server is closing its end of the TCP connection.
POP3端口995使用SSL加密,因此为了在端口995上与Gmail通信,您必须:
POP3 port 995 uses SSL encryption, so in order to communicate with Gmail on port 995, you must:
-
分配
TIdSSLIOHandlerSocketBase
派生到TIdPOP3.IOHandler
属性的组件,例如TIdSSLIOHandlerSocketOpenSSL
(并部署2带有您的应用的OpenSSL DLL)。
assign an
TIdSSLIOHandlerSocketBase
-derived component to theTIdPOP3.IOHandler
property, such asTIdSSLIOHandlerSocketOpenSSL
(and deploy the 2 OpenSSL DLLs with your app).
将 TIdPOP3.UseTLS
属性设置为 utUseImplicitTLS
。
如果在Gm中启用了2要素身份验证所有帐户,请创建一个应用专用密码供您的应用使用的真实Gmail密码(因为Indy尚未实现POP3和支持OAuth身份验证其他协议)。
if you have 2-factor authentication enabled in your Gmail account, create an application-specific password for your app to use instead of your real Gmail password (as Indy does not yet implement support for OAuth authentication for POP3 and other protocols).
这篇关于使用C ++ Builder读取gmail pop3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!