我有一个 Gmail 帐户,在收件箱邮箱文件夹中有 12,000 封邮件。我的问题是我只想接收前 100 条邮件,我尝试了很多但失败了。这是代码
ImapClient go_client = new ImapClient();
CompletionResponse go_response = null;
Mailbox go_Folders_As_Tree = null;
go_client.Host = "Host";
go_client.Port = "port no";
go_client.Username = "user id";
go_client.Password = "pasword";
go_client.SSLInteractionType = EInteractionType.SSLPort;
go_response = go_client.Login();
go_Folders_As_Tree = go_client.GetMailboxTree();
Mailbox inbox = Mailbox.Find(go_Folders_As_Tree, "INBOX");
MessageCollection tmp = go_client.GetAllMessageHeaders(inbox);
foreach (ImapMessage msg in tmp)
{
ImapMessage actual_message = go_client.GetMessageText(msg.UID, go_Folders_As_Tree.Children[1]);
}
这样我就必须等待我所有的 12,000 封邮件。