首页 > 解决方案 > 有没有办法知道 IMAP4 服务器的已发送电子邮件的文件夹名称?

问题描述

在我的 Delphi 10 应用程序中,我使用 tidIMAP4 使用此(部分)代码检索电子邮件

with IMAP4 do begin
case kind of
  1  : MsgBox := 'INBOX';
  10 : MsgBox := '[Gmail]/Sent Mail';//for GMail
  2  : MsgBox := '[Gmail]/Bin/Deleted Items';//for GMail
  3  : MsgBox := '[Gmail]/Spam';//for GMail
end;

SelectMailBox(MsgBox);
SetLength(SearchInfo, 1);
SearchInfo[0].Date := date-1;
SearchInfo[0].SearchKey := skSince; 

if SearchMailBox(SearchInfo)
and (High(MailBox.SearchResult) > -1) then
            try
                msgs := High(MailBox.SearchResult)+1;
.....

我可以使用此代码找到服务器的邮箱

var st : TstringList := TstringList.Create;
IMAP4.ListMailBoxes(st);
showmessage(st.Text);
st.Free;

SelectMailBox(MsgBox)因此,当我先验地知道 IMAP4 服务器时,我可以知道必须放入函数中的文件夹名称。

但我想要一种一致的方式来了解每个服务器(雅虎、用户服务器等)

类似SelectMailBox('deleted')或类似的东西。这可能吗 ?

标签: delphiimapindy

解决方案


推荐阅读