我正在尝试以编程方式解析 Gmail 的各种索引功能,但无法找到我认为是标准电子邮件 header 的某些 header 。我正在使用 Zend IMAP 库,并且在身份验证以及查看/操作我的 Gmail 方面没有任何问题。但是,我遇到了缺少某些 header 的问题。例如
- 大约十分之一的邮件缺少“message-id” header ,其中包括许多从其他 Gmail 地址发送的邮件
- 有时,附件 header 中会缺少“内容类型”、“内容处置”和“文件名” header ,但这种情况很少见。这些消息似乎总是属于较长消息线程的一部分。
任何人都可以解释为什么这些 header 可能会丢失吗?如果缺少“message-id” header ,则使用什么作为唯一标识符?也许是其他 header 的某种组合?
最佳答案
根据RFC 5322 :
The only required header fields are the origination date field and the originator address field(s). All other header fields are syntactically optional.
同一个 RFC 说:
Though listed as optional in the table in section 3.6, every message SHOULD have a "Message-ID:" field. Furthermore, reply messages SHOULD have "In-Reply-To:" and "References:" fields as appropriate and as described below.
所以严格来说 Message-ID 并不是强制性的。如果丢失,请尝试查找 In-Reply-To 或 References 字段。
关于php - Gmail 邮件缺少 header 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5070879/