What is the unique identification for emails?
Asked Answered
L

3

18

I'm trying to find the guaranteed unique identifier to distinguish emails from each other. Currently, I am writing an application which connects to Microsoft Exchange, however I want to be able to support other email services.

I think that the unique identifier is the EmailMessage.InternetMessageId, and that this property uses the PR_ENTRYID, except that I can't find any documentation to support this.

Do all emails have a unique identifier and is that (in Exchange) the InternetMessageId?

Lawler answered 6/8, 2012 at 20:41 Comment(3)
If only each e-mail got a GUID that was reliably generated...Smashandgrab
You could try a hashing algorithm.Ladle
How about EmailMessage.ItemId.UniqueId ?Earthling
F
15

There is no guaranteed unique id for emails, the Message-ID is about as close as you come. The best you can actually hope for is unique for the server...and even that depends upon the type of mail server and what it does.

Filippo answered 6/8, 2012 at 20:49 Comment(1)
Just to add that in Exchange, EntryID is related to the parent folder. Moving a message to a different folder will change its EntryIDRaphaelraphaela
K
4

I guess that's something never 100% guaranteed. I mean that number comes from special Email headers developed during time and described officially by specific RFC documents. Sometimes it may be a special information provided by a special service like Exchange (what you cited in your question). Even if I can't give you a really complete answer, I can tell for sure you should be aware of the fact you have no guarantees of unicity. For further reading I found an interesting answer on SO related to the above said header in the abstract domain of Internet Mail Messages: Is the "Message ID" Email Header unique for each recipient?

Knp answered 6/8, 2012 at 20:53 Comment(0)
M
4

How about using a hash function that could yield a unique hash considering some elements of the email message. i.e. GetEmailHash(dateTimeReceived+sender+subject+body)

Martres answered 14/8, 2017 at 10:50 Comment(2)
The time will vary at which any recipient recieves the email, that depends on the mail service, time zones and internet delay.Coenzyme
We cannot use time and then hash it.Coenzyme

© 2022 - 2024 — McMap. All rights reserved.