这个问题已经有一个答案在这里:

现在它容框但迟早我希望它的规模。

我要同步的副本生活的个人邮箱(电子邮件收件箱,箱)在其他地方,但是我不想影响 unread 国家的任何未读消息。

什么类型的访问将使这一最简单的?我找不到任何信息,如果IMAP会影响读国,但它出现的我可以手动的复位一个消息来未读。流行的定义并不影响未读的状态,但似乎没有人使用流行访问他们免费为什么?

有帮助吗?

解决方案 5

如果它有助于任何人,再让你 接收电子邮件作为HTTP请求, ,所以现在我只是转发的电子邮件在那里。

其他提示

在IMAP世界上,每个消息具有标志。你可以设定的各个标志就每个信息。当你获取的消息,实际上它是可以读取信息,而不应用\看到标志。

大多数邮件的客户会用\看到标志消息时的阅读。因此,如果消息已经阅读,外部的应用程序,然后你将需要删除\看到标志。

只是作为参考...这里是有关部分关于标志从Rfc:

一个系统的标志是一个标志,名称是预定在这 规范。所有系统的标志开始与"\".某些系统 标志(\删除,并\看到的)具有特殊的语义的描述 在其他地方。目前定义的系统的标志是:

    \Seen
       Message has been read

    \Answered
       Message has been answered

    \Flagged
       Message is "flagged" for urgent/special attention

    \Deleted
       Message is "deleted" for removal by later EXPUNGE

    \Draft
       Message has not completed composition (marked as a draft).

    \Recent
       Message is "recently" arrived in this mailbox.  This session
       is the first session to have been notified about this
       message; if the session is read-write, subsequent sessions
       will not see \Recent set for this message.  This flag can not
       be altered by the client.

       If it is not possible to determine whether or not this
       session is the first session to be notified about a message,
       then that message SHOULD be considered recent.

       If multiple connections have the same mailbox selected
       simultaneously, it is undefined which of these connections
       will see newly-arrived messages with \Recent set and which
       will see it without \Recent set.

有一个.PEEK项上取命令在IMAP,将明确地不设置/看到标志。

看看 FETCH命令在RFC3501 和滚下来一点,第57页,或搜索"的身体。PEEK".

需要指定部分时使用的身体。偷看。部分解释了 IMAP取命令 文件下的体[<section>]<<partial>>

import getpass, imaplib

M = imaplib.IMAP4()
M.login(getpass.getuser(), getpass.getpass())
M.select()
typ, data = M.search(None, 'ALL')
for num in data[0].split():
    typ, data = M.fetch(num, '(BODY.PEEK[])')
    print 'Message %s\n%s\n' % (num, data[0][5])
M.close()
M.logout()

PS:我想修复给出的答案 木基因 但是不允许的,因为编辑小于6个字符的(体。偷看->的身体。PEEK[])

没有人使用流行,因为通常他们 额外的功能IMAP,例如跟踪消息状态。当此功能只是让你的方式和需要的解决方法,我认为使用流行是你最好的赌注!-)

跟进 丹*戈德斯坦的回答上面, 在蟒蛇的语法使用"。看"选择就是呼叫 IMAP4。获取 并通过它"身体。偷看"

申请这一例子中的 蟒蛇医 :

import getpass, imaplib

M = imaplib.IMAP4()
M.login(getpass.getuser(), getpass.getpass())
M.select()
typ, data = M.search(None, 'ALL')
for num in data[0].split():
    typ, data = M.fetch(num, '(BODY.PEEK)')
    print 'Message %s\n%s\n' % (num, data[0][5])
M.close()
M.logout()
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top