GMail 和 POP3 RETR 问题 - 切换到 IMAP?

发布于 2024-08-19 16:58:16 字数 457 浏览 6 评论 0原文

当我使用 POP3 协议访问 GMail 收件箱时,似乎在使用 RETR 命令获取给定电子邮件后,退出并重新连接后,调用 LIST 时不再列出以前的 RETR-ieved 电子邮件。

然后,转到:GMail 设置//转发和 POP/IMAP 并设置“为所有邮件启用 POP(甚至已下载的邮件)”,下次登录时,所有电子邮件将再次列出,但如果我 RETR 任何邮件其中,重新登录后它再次从列表中消失。

然后我可以再次转到 GMail 设置并重复整个过程,但这对我来说是一个阻碍,因为我正在编写一个无需任何手动操作即可工作的脚本。

我是否遗漏了什么,或者只有 IMAP 可以提供帮助?

(编辑:RFC http://www.ietf.org/rfc/rfc1939.txt没有提及 RETR 命令删除消息)

When I'm accessing GMail inbox using POP3 protocol, it seems that after fetching given email using RETR command, after QUIT-ting and reconnecting, previously RETR-ieved email is not listed anymore when calling LIST.

Then, after going to: GMail settings//Forwarding and POP/IMAP and setting "Enable POP for all mail (even mail that's already been downloaded)", on next login all emails are being LIST-ed again, but if I RETR any of them, it again disappears from LIST after re-logging..

I can then go to GMail settings again and repeat the whole process, but it's a show-stopper for me as I'm writing a script that should work without any manual actions.

Am I missing something, or only IMAP can help here?

(EDIT: RFC http://www.ietf.org/rfc/rfc1939.txt doesn't say a word about RETR command deleting messages)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

压抑⊿情绪 2024-08-26 16:58:16

这是 Gmail 的预期行为。根据此问题,“[a ]所有邮件可能会被下载到另一台计算机一次;下载邮件后,将不会再次下载。”

还有“最近模式”,其中获取最近 30 天的邮件,无论它是否已发送到另一个 POP 客户端。

也就是说,不要尝试在短时间内通过不同的计算机获取所有邮件,例如Gmail 可能会阻止您的帐户 24 小时

我强烈建议使用 IMAP。

This is intended behaviour of Gmail. According to this question, "[a]ll messages may be downloaded to another computer once; after downloading mail, it will not download again."

There's also a 'recent mode', in which the last 30 days of mail are fetched, regardless of whether it's been sent to another POP client already.

That said, don't try to fetch all your mail by different computer in a short period of time, as Gmail may block your account for 24 hours.

I strongly suggest using IMAP.

心头的小情儿 2024-08-26 16:58:16

Gmail 的 POP3 配置有时可能会令人困惑。您可以在此处找到 Gmail POP3 行为

切换到 IMAP 是一个非常好的解决方案。

Gmail’s POP3 configuration maybe sometimes confusing. You can find Gmail POP3 behavior here.

Switching to IMAP is very good solution.

橘虞初梦 2024-08-26 16:58:16

这是一个常见问题,不幸的是,它并不总是有最简单的解决方案。希望这些信息能够帮助您和其他人找到适合您需求的最佳实施方案。免责声明:如果您可以选择或能够将 IMAP 添加到您的 pop3,它肯定会让事情变得更易于管理。

Gmail 有自己的 Pop3 实现,话虽如此,但并非所有这些都与其他 pop3 提供商相关
以下是该问题的生命周期以及一些可以帮助您管理该问题的信息:

您以“正常”模式或“最近”模式连接到 pop3 服务器。这会将 pop 服务器上的“会话”置于“事务状态”。
最近模式的使用方式是在连接时在用户名前加上“最近:”+ 用户名前缀。最近模式将返回服务器上最近 30 天的电子邮件。注意*这将取代我将在下面谈到的 UIDL 命令。即,如果电子邮件未被删除,最近模式将返回所有 30 天的电子邮件。由于它始终返回最近 30 天的信息,因此如果您有多个客户,他们都将在最近模式下收到相同的信息。

正常模式是默认模式。正常模式将尊重您选择使用的命令的限制。 UIDL 将返回服务器上大约 250 封最旧电子邮件的块。如果您的服务器上有 500 封电子邮件,并且您没有删除任何电子邮件,则 UIDL 将返回前 250 封电子邮件的 ID 和唯一标识符,因此您可能不知道新的 250 封电子邮件。这里需要注意的是,GMAIL Web 控制台上有一个选项,您可以在其中配置弹出窗口,“从现在开始启用弹出窗口”。通过选择并保存,弹出服务器将使用该时刻的时间戳来“刷新”最旧的时间。因此,UIDL 将从该点开始向您返回消息,直到您再次达到 250 标记(假设您尚未删除它们)。

需要注意的是,事务状态在您发出 QUIT 命令之前一直存在。发出该命令后,服务器进入“更新”状态,它将开始发出您请求的更新,例如 DELETE 命令,或在下载后弹出它们。在成功发出 QUIT 之前,不会删除任何内容,并且服务器状态不会更改。

STAT 命令将显示您服务器上 pop3 堆栈中的电子邮件数量。

RETR 命令将检索或下载电子邮件,但在您成功结束会话之前,它不会被标记为已下载

UIDL(许多开发人员使用 UIDL 来检索消息号和唯一标识符)如果您维护服务器的状态并弹出该电子邮件,则非常有用电子邮件。 UIDL 只会返回最旧的 250 封左右(我见过 251-255 封)电子邮件。如果您不断轮询新电子邮件,并且电子邮件尚未删除,那么这很危险。还!如果您需要删除电子邮件,请确保在 Web 控制台中将 GMAIL 设置配置为“在我的收件箱中保留副本”,以便您可以访问这些电子邮件作为备份。

LIST 命令可以解决您在正常模式下收到超过 250 封电子邮件的问题,(注意:您仍然需要在本地维护一个 id 文件来交叉检查传入的邮件,以便知道它是新的还是旧的)...但是:此命令还会从“发送”框中返回邮件,这对于许多人来说不是一个可行的解决方案。

提示:

如果您正在快速有效地管理收件箱,并且不认为 250 是流程中的限制因素,则 UIDL 和 RETR 将会起作用。

如果您无法将收件箱保持在 250 个以下,但又需要访问新电子邮件,并且您不希望收件箱增长到惊人的大小,并且不关心性能,则“最近”模式应该可以使用。

This is a common problem, unfortunately, it does not always have the easiest solution. Hopefully, this information will help you and others arrive at the best implementation that suits your needs. Disclaimer: if you have the option or capability to add IMAP to your pop3, it certainly makes things more manageable.

Gmail has its own Pop3 implementation, and with that said, not all of this is relevant to other pop3 providers
Here is the lifecycle of the issue and some information that can help you manage it:

You connect to the pop3 server either in NORMAL mode or RECENT mode. This puts the "session" on the pop server into a "transaction state".
Recent mode is used by prefixing the username on connection with "recent:" + Username. Recent mode will return the last 30 days of email on the server. Note* this will supersede the UIDL command which I will touch on below. I.e. recent mode will return all 30 days worth of email if they have not been removed. Since it always returns the last 30 days, if you have multiple clients, they will all receive the same information in recent mode.

Normal mode is the default. Normal mode will respect the limitations of the commands you choose to use. UIDL will return a chunk of roughly 250 of the oldest emails on the server. If you have 500 emails on the server, and you do not remove any, UIDL will return the id and Unique Identifier for those first 250 emails regardless, so you may not be aware of the new 250. The caveat here is as follows, GMAIL has an option on the web console where you configure pop, to "Enable pop from now on". By selecting that and saving, the timestamp at that moment will be used by the pop server to "refresh" the oldest time. Therefore UIDL will start returning messages back you from that point on up until you reach the 250 mark again (assuming you have not removed them).

It is important to note that the transaction state exists until you issue the QUIT command. Upon issuing that command the server enters the "Update" state, where it will begin issuing the updates you requested, like DELETE commands, or popping them after they have been downloaded. Until QUIT is issued successfully, nothing will be deleted and the server state does not change.

STAT command will show you the number of emails in the pop3 stack, that are on your server.

RETR command will retrieve, or download the email, but it is not marked as downloaded until you successfully end the session

UIDL which many developers use to retrieve the message numbers and unique identifiers is very useful if you maintain the state of the server and pop the email. UIDL will only ever return the oldest 250-ish (I have seen 251-255) emails. If you are constantly polling for new email, this is dangerous if email hasn't been removed. ALSO! if you need to delete email, make sure the GMAIL setting to, Keep a copy in my inbox, is configured in the web console, so that you have access to those emails as a backup.

LIST command would solve your problem in normal mode for getting more than 250 emails back, (note: you still need to maintain an id file locally to cross-check incoming mail in order to know that it is new or old)... HOWEVER: this command also returns mail from the SENT box, which for many, is not a viable solution.

Hints:

If you are managing the inbox quickly and effectively and do not believe 250 to be a limiting factor in your process, UIDL and RETR will work.

If you will not be able to keep your inbox below 250 but also need access to new email, AND you do not expect the inbox to grow to outrageous size and the performance is not concerning, RECENT mode should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文