[英]Can i use pop3client to download only the newestm essages for example only the 5 newest messages?
Now it's downloading all the messages and i have a lot of them on the server of my internet account. 现在它正在下载所有消息,而我的Internet帐户服务器上有很多消息。 Then after i'm downloading all the messages it will download only the newest messages.
然后,在我下载所有消息之后,它将仅下载最新消息。 But i wonder if i wanted on the first time instead of downloading all the messages to download only the newest 5 messages only ?
但是我想知道我是否想第一次而不是下载所有消息仅下载最新的5条消息吗? Or the newest 100 messages only ?
还是仅最新的100条消息? And not all the messages on the server.
并非服务器上的所有消息。
using (var client = new Pop3Client())
{
client.Connect(textServer.Text, Convert.ToInt32(textPort.Text), ssl);
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Authenticate(textUser.Text, textPassword.Text);
var uids = client.GetMessageUids();
for (int i = 0; i < client.Count; i++)
{
if (backgroundWorker1.CancellationPending)
{
e.Cancel = true;
return;
}
if (!downloaded.Contains(uids[i]))
{
allMessages.Add(client.GetMessage(i));
newmsg = client.GetMessage(i);
downloaded.Add(uids[i]);
SaveFullMessage(client.GetMessage(i), i);
w = new StreamWriter(emailsIDSFile, true);
w.WriteLine(uids[i]);
w.Close();
}
int nProgress = (client.Count - i + 1) * 100 / client.Count;
backgroundWorker1.ReportProgress(nProgress,newmsg);//, client.Count.ToString() + "/" + i);
newmsg = null;
}
client.Disconnect(true);
}
I'm getting a List of all the messages Uids: 我正在获取所有消息Uid的列表:
var uids = client.GetMessageUids();
And i wonder if i could somehow to do something like in logical: Download only the newest 5 Uids messages or the newest 100 Uids messages. 而且我想知道我是否可以通过某种方式做逻辑上的事情:仅下载最新的5个Uid消息或最新的100个Uid消息。 I wonder how and if i can select from the Uids List only the newest 5 or 100 messages to be downloaded.
我想知道如何以及是否可以从Uid列表中选择要下载的最新5或100条消息。
I don't need and don't care for now about all the messages on the server i want to check only for the N newest messages for example 5 or 100 newest messages. 我不需要也不关心服务器上的所有消息,我只想检查N条最新消息,例如5条或100条最新消息。
Instead of calling GetMessageUids, call GetMessageUid multiple times with an increasing message number each time. 而不是调用GetMessageUids,而是多次调用GetMessageUid,每次消息数量都在增加。
See [ http://hpop.sourceforge.net/documentation/OpenPop~OpenPop.Pop3.Pop3Client.GetMessageUid.html] 请参阅[ http://hpop.sourceforge.net/documentation/OpenPop~OpenPop.Pop3.Pop3Client.GetMessageUid.html]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.