IMAPMessage.getUID()和Message-ID标头之间有什么区别? [英] What is the difference between IMAPMessage.getUID() and Message-ID header?

查看:460
本文介绍了IMAPMessage.getUID()和Message-ID标头之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Java邮件的角度来看,这两者之间有什么区别?我可以看到,对于一条特定消息,2个值不相同.那么我应该考虑IMAP消息的唯一ID?

What is the difference between these two from java mail perspective? I can see that 2 values are not same for a particular message. So what should I consider an IMAP message's unique id?

如果我需要从IMAP服务器中获取与唯一ID相对应的消息,我应该使用吗?

If I need to fetch message from an IMAP server corresponding to an unique id, should I use?

MessageIDTerm

IMAPFolder.getMessageByUID()

推荐答案

UIDIMAP folder中电子邮件的唯一标识号.文件夹中的每个邮件都分配有一个uid,可以说是由邮件文件夹维护的索引.而message-id是电子邮件的header部分.

UID is the unique identification number of a email in a IMAP folder. Each mail in a folder is assigned a uid, it is you can say a index maintained by the mail folder. Whereas message-id is a header part of a email.

简单来说, UID是唯一的数字,不能在文件夹中重复.如果我将同一封电子邮件复制两次到一个文件夹中,则每封邮件将具有相同的标头,具有相同的message-id,但具有不同的UID.

To understand in a simple term, UID is a unique number which cannot be duplicated within a folder. If I copy same email twice in a folder, each will have same headers having same message-id but will have a different UID.

其他主要区别是,

  • UID由imap服务器分配
  • MessageId由电子邮件设置 客户.
  • UID's are assigned by a imap server
  • MessageId's are set by the email client.

因此,最好总是依靠UID提取电子邮件.

So it is always better to rely on a UID to extract the email.

引用: RFC-UID

这篇关于IMAPMessage.getUID()和Message-ID标头之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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