How a single IMAP parameter silently marked 9,133 emails as read
A developer discovered that an automated mail-polling bot had marked over 9,100 personal Gmail messages as read within seconds of their arrival. The root cause was the use of the RFC822 fetch command in IMAP, which per the RFC 3501 specification automatically sets the \Seen flag on any message it retrieves. Suspicion initially fell on the adapter's filtering logic, but the filters were functioning correctly — the side effect occurred upstream during the fetch itself, before filtering even ran. Switching to BODY.PEEK[] retrieved identical message content without triggering the flag, but this broke the bot's UNSEEN-based search, which had been silently relying on the side effect to track new messages. The developer resolved the issue by replacing the UNSEEN search with an explicit UID high-water mark and verified the fix by confirming a newly arrived message remained unread after polling.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in