+3 votes

We need to keep in our db, the unique id for each message. I read on your site the story about the Unique ID in IMAP protocol but is not clear for me.

Do you suggest strategies to get key based for example from information in the header email (for fast retrieve information).

by

1 Answer

0 votes
 
Best answer

You can find detailed explanation in Unique ID in IMAP protocol article.

I'd keep:

If your server doesn't change folder's UIDVALIDITY (99% true):

  1. keeping UID is enough,
  2. additionally keep Message-ID header.

If your server changes UIDVALIDITY (probably it doesn't):

  1. UID + folder's UIDVALIDITY + folder's name (this uniquely
    identifies an email on your email server)
  2. additionally keep Message-ID header.
  3. You can additionally compute SHA1 hash from the message eml data.
by (297k points)
...