OpenPop.我不能收到所有来自Gmail的邮件

本文关键字:Gmail 不能 OpenPop | 更新日期: 2023-09-27 18:01:39

我有这样的代码:

public List<Attachment> GetAttachments() {
    string hostname = "pop.gmail.com";
    int port = 995;
    bool useSSL = true;
    string attachmentType = "application/pdf";
    string email = "myemail@gmail.com";
    string emailFrom = "someone@gmail.com";
    string password = TxtBoxPassword.Text;
    if (!string.IsNullOrWhiteSpace(password))
    {
        Pop3Client client = new Pop3Client();
        client.Connect(hostname, port, useSSL);
        client.Authenticate(email, password, AuthenticationMethod.UsernameAndPassword);
        List<Attachment> listAttachments = new List<Attachment>();
        int count = client.GetMessageCount();
        for (int i = count; i >= 1; i--)
        {
            Message message = client.GetMessage(i);
            if (message.Headers.From.MailAddress.Address == emailFrom)
            {
                List<MessagePart> attachments = message.FindAllAttachments();
                foreach (MessagePart attachment in attachments)
                {
                    if (attachment.ContentType.MediaType == attachmentType)
                        listAttachments.Add(new Attachment(attachment));
                }
            }
        }
    }
}

查看电子邮件帐户中的所有邮件。

它访问电子邮件帐户,从发送/收件箱文件夹中获得265封电子邮件。

目前我的帐户中有超过1000封电子邮件,所以我希望看到这个数字的电子邮件计数。

代码/Gmail帐户设置中缺少什么阻止我获得所有电子邮件?

谢谢

OpenPop.我不能收到所有来自Gmail的邮件

gmail在POP3功能上有一些怪癖。当Gmail被编程地用作POP3服务器时,它会表现出哪些非标准的行为特征?我认为你不能改变任何设置来解决你的问题