简体   繁体   English

如何使用MD5哈希值比较电子邮件

[英]How to compare emails using MD5 hashes

I've heard MD5 hashes can be used to compare contents of eg a file. 我听说MD5哈希可以用来比较文件的内容。 The MimePart class in the JavaMail library also contains a setContentMD5() method, but I couldn't find an example for using it. JavaMail库中的MimePart类还包含setContentMD5()方法,但是我找不到使用它的示例。 Can I use it to compare email content using the hashes (and verify there was no loss of data during the download)? 我可以使用它来比较散列中的电子邮件内容(并确认下载期间没有数据丢失)吗? Of which part should I then generate the MD5 hash? 然后,我应该在哪一部分中生成MD5哈希?

Also, the getContentMD5() doesn't work when I use IMAP (although the header is actually present). 另外,当我使用IMAP时, the getContentMD5()不起作用(尽管实际上存在标头)。

The Content-MD5 header is an optional MIME header set by the creator of the message. Content-MD5标头是消息创建者设置的可选MIME标头。 If the header exists on some of your messages and your IMAP server isn't returning it, that's a bug in your IMAP server. 如果标头存在于您的某些邮件上,而IMAP服务器未返回标头,则说明您的IMAP服务器中存在错误。

Given that the header is optional, and at least in my mailbox there are no messages with that header, it's probably not going to help you with your problem. 鉴于标题是可选的,并且至少在我的邮箱中没有包含该标题的邮件,因此它可能无法帮助您解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM