具有IMAP的唯一电子邮件标识符 [英] Unique Email Identifiers with IMAP

查看:80
本文介绍了具有IMAP的唯一电子邮件标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Django/Python中创建一个GMail电子邮件接口.我想创建所有电子邮件的框架,其中包含主题和日期,这是一种概述级别的索引,这样,即使删除了电子邮件,我也有一个指示符,指出该电子邮件的存在以及发送的时间.

I am creating an GMail email interface in Django/Python. I want to create a skeleton of all emails, containing subject and date, a kind of overview-level index, so that even if an email is deleted, I have an indicator it existed and when it was sent.

我的问题是,考虑到IMAP UID的变化,我可以用作唯一的电子邮件标识符吗?即使我在数据库中创建具有唯一ID的每封电子邮件的框架,如果我将电子邮件UID和IMAP文件夹名称与之关联,删除其他电子邮件时UID也会更改.

My problem is, considering that IMAP UIDs change, what can I use as a unique email identifier? Even if I create the skeleton of each email with a unique ID in my database, if I associate a email UID and IMAP folder name to it, the UID can change when other emails are deleted.

为电子邮件创建唯一标识符的最佳解决方案是什么?我当时正在考虑使用(发送日期,主题)组合,但是我正在寻找更简单的方法.

What would be the best solution to create a unique identifier for an email? I was thinking of using a (sent date, subject) combination, but I was looking for something simpler.

有人可以帮忙吗?

谢谢

推荐答案

我的理解是UID不会改变...因此可以将其用作IMAP/数据库之间的链接.

My understanding is that the UID won't change... so should be fine to use that as a link between IMAP/your DB.

从RFC3501(更新RFC822)开始- http://www.limilabs.com/mail/rfc/3501

From RFC3501 (updates RFC822) - http://www.limilabs.com/mail/rfc/3501

2.3.1.1.唯一标识符(UID)消息属性

2.3.1.1. Unique Identifier (UID) Message Attribute

分配给每个消息的32位值,当与
一起使用时唯一标识符有效性值(请参见下文)形成一个64位值
不得引用邮箱中的任何其他消息或任何
随后的邮箱永远具有相同的名称.唯一标识符
在邮箱中严格按照升序分配;每个
邮件已添加到邮箱,并且为其分配的UID高于
先前添加的消息.与消息序列不同
数字,唯一标识符不一定是连续的.

A 32-bit value assigned to each message, which when used with the
unique identifier validity value (see below) forms a 64-bit value
that MUST NOT refer to any other message in the mailbox or any
subsequent mailbox with the same name forever. Unique identifiers
are assigned in a strictly ascending fashion in the mailbox; as each
message is added to the mailbox it is assigned a higher UID than the
message(s) which were added previously. Unlike message sequence
numbers, unique identifiers are not necessarily contiguous.


期间,消息的唯一标识符不得更改会话,并且不应在会话之间进行更改.
的任何更改会话之间的唯一标识符必须使用
UIDVALIDITY机制将在下面讨论.

The unique identifier of a message MUST NOT change during the
session, and SHOULD NOT change between sessions. Any change of
unique identifiers between sessions MUST be detectable using the
UIDVALIDITY mechanism discussed below.

这篇关于具有IMAP的唯一电子邮件标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆