One Day Sec

What is the difference between email sequence numbers and UIDs in IMAP, and how can I retrieve UIDs in Python?

Email sequence numbers are incremental numbers starting from 1 within a mailbox, while UIDs are unique and persistent identifiers that remain constant even after other emails are deleted. To retrieve the UID of each email in Python, use `M.fetch(num, 'UID')` instead of `'(RFC822)'`. This distinction is important when you need to track specific emails across sessions. More details are in the Penetration Basics - Reading Emails Using the IMAP Protocol article.
IMAP UIDsequence numberunique identifierM.fetch UIDemail tracking

Browse all Q&A →