1

我想从我的 gmail 收件箱中获取所有邮件,但我面临 2 个问题。

  1. 它没有收到所有的电子邮件,(根据统计函数中的计数)
  2. 它收到的电子邮件顺序是随机的。

我不确定是 poplib 还是 gmail pop 服务器的问题。

我在这里想念什么?

4

4 回答 4

2

您也可以尝试imaplib模块,因为 GMail 还提供通过 IMAP 协议访问电子邮件的功能。

于 2009-03-09T21:39:14.737 回答
2

你的代码是什么样的?使用 poplib,您可以决定下载消息的顺序和数量。poplib 文档中的代码应该可以工作:

import getpass, poplib

M = poplib.POP3('localhost')
M.user(getpass.getuser())
M.pass_(getpass.getpass())
numMessages = len(M.list()[1])
for i in range(numMessages):
    for j in M.retr(i+1)[1]:
        print j
于 2009-03-09T21:19:39.747 回答
1

你为什么不尝试使用libgmail

于 2009-03-06T12:28:55.443 回答
0

It's the problem of gmail: https://mail.google.com/support/bin/answer.py?answer=13291

Try to use recent:username@gmail.com as your email address. At least you'll have all your last month mail in correct order.

于 2011-06-03T18:20:53.677 回答