OpenPop - Gmail的 - GetMessageCount()返回0(零) [英] OpenPop - Gmail - GetMessageCount() returns 0 (zero)
问题描述
当连接与OpenPop Gmail时,我只能检索一封电子邮件,即使我不删除它。使用GetMessageCount()我总是收到0电子邮件。我怎样才能得到一切在那里的电子邮件?
只有阅读他们,他们加工后做给我命令删除。我使用下面的code,以获得电子邮件:
使用(VAR的客户=新Pop3Client())
{
//连接到服务器
client.Connect(serverData.Hostname,serverData.Port,serverData.UseSsl); //验证自己对服务器
client.Authenticate(serverData.Username,serverData.Password,AuthenticationMethod.UsernameAndPassword); VAR emailAmount = client.GetMessageSizes()计数。 //获取所有观察到的当前的uid
变种MSGCOUNT = client.GetMessageCount(); .....
}
Gmail是特别即可。看看这个StackOverflow的帖子这也解释了不规范的行为。
你所感兴趣的是,Gmail将只显示消息的 ONE 的POP3会议,除非你做特别的东西,比如prepending的最近的:的您的用户名前面
When connecting to Gmail with OpenPop, I can only retrieve an email once, even if I do not delete it. Using GetMessageCount() I always receive 0 emails. How can I get all the emails that are there?
Only after reading them and processing them do I give order to delete. I am using the following code to get the emails:
using (var client = new Pop3Client())
{
// Connect to the server
client.Connect(serverData.Hostname, serverData.Port, serverData.UseSsl);
// Authenticate ourselves towards the server
client.Authenticate(serverData.Username, serverData.Password, AuthenticationMethod.UsernameAndPassword);
var emailAmount = client.GetMessageSizes().Count;
// Fetch all the current uids seen
var msgCount = client.GetMessageCount();
.....
}
Gmail is special. Take a look at this StackOverflow post which explains the non-standard behavior.
What you are interested in, is that Gmail will only show a message in ONE POP3 session, unless you do special stuff, like prepending recent: in front of your username.
这篇关于OpenPop - Gmail的 - GetMessageCount()返回0(零)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!