4

关于我之前关于在 Gmail 中访问“已发送邮件”文件夹的问题,接受的答案中提供的代码使用 UIDRetrieveAllEnvelopes 下载文件夹中的所有邮件标题。下载完所有标题后,我会对其进行过滤。

有没有办法下载当天发送的消息(即下载前过滤)?

4

2 回答 2

2

没有办法只检索某个文件夹中某一天的邮件。

IMAP 方式是缓存消息/信封并仅检索最近/新消息。查看TIdIMAP4.StatusMailboxTIdIMAP4.RetrieveFlags检查哪些消息对客户端来说是新消息并仅下载这些消息/enelopes。

可能的标志是

  TIdMessageFlags =
  ( mfAnswered, //Message has been answered.
    mfFlagged, //Message is "flagged" for urgent/special attention.
    mfDeleted, //Message is "deleted" for removal by later EXPUNGE.
    mfDraft, //Message has not completed composition (marked as a draft).
    mfSeen, //Message has been read.
    mfRecent ); //Message is "recently" arrived in this mailbox.
于 2013-06-29T10:20:08.707 回答
0

我好像找到了办法

 today:= datetostr (date);
 with imap do
  begin
   Username:= 'whatever@gmail.com';
   Password:= ....;
   Connect;
   if SelectMailBox('[Gmail]/sent items') then
    begin
     i:= MailBox.TotalMsgs;
     retrieve (i, email);
     while datetostr (email.date) = today do
      begin
       lb.items.add (email.subject + ' ' + datetostr (email.date));
       dec (i);
       retrieve (i, email)
      end 
    end;
   Disconnect;
  end; 
于 2013-06-29T13:37:24.850 回答