题
我只是为了娱乐Delphi中的一个未读消息检查器应用程序。我正在使用Indy10。我可以与Gmail连接,可以检索所有消息,但是我在这里遇到问题:我无法确定是否已经读了一条消息。 Tidmessage组件中有一个标志属性,应该告诉我是否已读取该消息。代码看起来像这样:
procedure TForm1.btTestConnectionClick(Sender: TObject);
var
i: Integer;
count: Integer;
flag: TIdMessageFlags;
begin
if (pop3Test.Connected) then begin
pop3Test.Disconnect;
end;
pop3Test.Username := edAccount.Text;
pop3Test.Password := edPassword.Text;
pop3Test.Host := HOST;
pop3Test.AuthType := patUserPass;
pop3Test.Port := PORT;
pop3Test.Connect;
Count := 0;
for i := pop3Test.CheckMessages downto 1 do begin
pop3Test.Retrieve(i, IdMessage1);
if (mfSeen in IdMessage1.Flags) then begin
Count := Count + 1;
end;
end;
ShowMessage(IntToStr(Count));
pop3Test.Disconnect;
end;
在测试邮箱中,有一条未读的消息,但是所有检索到的消息都有标志枚举属性为空,因此结果总是0。我做错了什么?这是Indy/Gmail兼容性的问题吗?
谢谢。
编辑: 我肯定做错了什么,因为使用Hotmail帐户进行测试显示出相同的空范围属性问题。
解决方案
这 POP3
协议不支持 Message state information
在服务器上,如读取,回复或删除。尝试使用 IMAP for Gmail
反而。
其他提示
找到此答案的最好的(最快)方法是搜索Indy Sourcecode为“ Mfseen”搜索您应该发现它仅在IDIMAP*单位中使用。 RRUZ是正确的-POP3不提供此固有的能力。在POP3中,您需要在客户端进行跟踪。为了IMAP目的,该标志已添加到IDMessage中,而不一定是POP3。
TidmessageFlags可能应该被命名为TidimapMessageFlags
不隶属于 StackOverflow