Gmail POP3 未在 Java 应用程序中获取所有邮件

2022-01-23 00:00:00 email gmail pop3 java jakarta-mail

我已为我的 gmail 启用 POP3 设置.我可以在 Java 应用程序中使用我的密码连接到 POP3 商店.我的收件箱中有大约 10k 条消息.

I have enabled POP3 settings for my gmail. I am able to connect to the POP3 store using my password in a Java app. I have around 10k messages in my inbox.

当我在收件箱文件夹中调用 getMessages 时,它只返回 280 条旧邮件.当我在循环中调用 getMessages 时,每次调用都会返回相同的消息.我也试过 getMessages(start, end) 但它不返回除了 280 条以外的其他消息.

When I call getMessages on the Inbox folder it returns only 280 old messages. When I call getMessages in a loop, every call returns me same messages. I also tried getMessages(start, end) but it does not return other messages than those 280.

如何检索其他消息?

推荐答案

默认情况下,GMail 的 POP3 和 IMAP 服务器的行为不像标准的 POP3 或 IMAP 服务器,并且使用这些协议隐藏来自客户端的消息(以及其他非标准行为).

By default, GMail's POP3 and IMAP server does not behave like standard POP3 or IMAP servers and hides messages from clients using those protocols (as well as having other non-standard behavior).

如果您想配置您的 GMail POP3 或 IMAP 设置,使其按照 POP3 和 IMAP 的预期行为方式按照其协议规范运行,您需要通过网络浏览器登录到您的 GMail 帐户并导航到您的 GMail Settings 页面的 Forwarding and POP/IMAP 选项卡,并将您的选项设置为如下所示:

If you want to configure your GMail POP3 or IMAP settings to behave the way POP3 and IMAP are intended to behave according to their protocol specifications, you'll need to log in to your GMail account via your web browser and navigate to the Forwarding and POP/IMAP tab of your GMail Settings page and set your options to look like this:

POP3 下载

[X] 为所有邮件启用 POP(即使是已经下载的邮件)

[X] Enable POP for all mail (even mail that's already been downloaded)

IMAP 访问

[X] 启用 IMAP

[X] Enable IMAP

[X] 自动删除关闭 - 等待客户端更新服务器

[X] Auto-expunge off - wait for the client to update the server

[X]立即永久删除消息

[X] Immediately delete the message forever

相关文章