获取邮件未读内容,而不影响未读状态
现在我用的是一个 Gmail 邮箱,但我希望将来能扩展它的功能。
我想把我的个人邮箱(包括收件箱和发件箱)的内容同步到其他地方,但我不想影响任何未读邮件的状态。
哪种访问方式会让这个过程最简单呢?我找不到关于 IMAP 是否会影响邮件已读状态的信息,不过看起来我可以手动把邮件重置为未读。POP 理论上不会影响未读状态,但好像没有人用 POP 来访问他们的 Gmail,为什么呢?
6 个回答
3
在IMAP的FETCH命令中,有一个叫做.PEEK的选项,它的作用是明确不设置/Seen标记。
你可以查看RFC 3501中的FETCH命令,往下翻一点到第57页,或者搜索“BODY.PEEK”。
5
在IMAP的世界里,每条邮件都有一些标记。你可以为每条邮件设置不同的标记。当你获取一封邮件时,其实可以在不加上\Seen标记的情况下读取这封邮件。
大多数邮件客户端在你阅读邮件时会自动加上\Seen标记。所以,如果这封邮件在你的应用之外已经被阅读过,你就需要手动去除\Seen标记。
顺便提一下,这里有关于标记的相关信息,来自一些标准文档:
系统标记是指在这个规范中预先定义的标记名称。所有的系统标记都是以“\”开头的。有些系统标记(比如\Deleted和\Seen)有特别的含义,这些在其他地方有详细说明。目前定义的系统标记有:
\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.
0
如果对谁有帮助的话,GAE(谷歌应用引擎)允许你把电子邮件当作HTTP请求来接收,简单来说,就是我现在只是把邮件转发到那里。