title: How to uniquely identify an email with IMAP?
body: <p>I'm trying to receive and process mails by querying them with IMAP from a mail server. I need guaranteed at-most-once processing. Therefore, I need to be able to detect what mails I have already processed.</p>
  
  <p>The IMAP Unique ID cannot serve that purpose because it's validity might change. If that happens I have no way of relating already processed UIDs to the new UIDs that I'm seeing after the change.</p>
  
  <p><strong>How can I uniquely identify messages and achieve at-most-once processing?</strong></p>
  
  <p>In fact, how are mail clients such as Outloook doing this? If the validity changes they must be able to relate the locally stored mails to the new UIDs.</p>