SShortSingh.
Back to feed

How a single IMAP parameter silently marked 9,133 emails as read

0
·1 views

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.

Read the full story at DEV Community

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

Related stories

0
ProgrammingDEV Community ·

NETO: Open-Source P2P Chat Tool Lets Dev Teams Message Without Cloud Servers

NETO is a peer-to-peer chat application built specifically for software development teams operating on the same local network. The tool requires no accounts, no cloud infrastructure, and no external dependencies, keeping all communications entirely within the local environment. It uses mDNS (Multicast DNS) to automatically discover teammates on the network without manual IP or port configuration. Encryption is handled via X25519 Diffie-Hellman key exchange over Curve25519, securing messages before any content is transmitted. NETO positions itself as a privacy-focused alternative to cloud-based messaging platforms like Slack, where sensitive data such as credentials and architecture discussions may be stored on third-party servers.

0
ProgrammingDEV Community ·

Developer fixes AI content penalty by detecting structural duplicates with n-gram math

A developer running multiple B2B websites noticed that AI-generated comparison articles were indexed normally but ranked poorly, averaging position 76 across five domains despite generating around 50,000 impressions over three months. On closer inspection, hundreds of articles shared identical sentence-level patterns, passing plagiarism checkers as unique while remaining structurally near-identical. Using n-gram analysis and Jaccard similarity scoring, the developer built a detector that measured overlap between sliding word-window sets across article pairs, revealing several hundred paragraph pairs with a perfect similarity score of 1.00. The investigation found that long recurring text blocks dominated each article's structural fingerprint, and simple variant rotation only created a fixed number of distinct skeletons repeated across the entire content batch. The developer subsequently rebuilt the content generation pipeline to ensure every article pair scored measurably distinct under the same mathematical test.

0
ProgrammingDEV Community ·

SQL LIKE Operator Explained: How to Search Text Patterns in Databases

SQL's LIKE operator allows developers to search for text patterns within database columns, unlike the equality operator which requires an exact match. It uses two wildcards: the percent sign (%) to represent any sequence of characters including none, and the underscore (_) to represent exactly one character. For example, querying WHERE name LIKE '%Shirt%' returns all rows containing the word 'Shirt' anywhere in the column, while the equals operator would only return rows where the entire value is 'Shirt'. Wildcards can be combined to match structured formats such as product codes or account numbers where the pattern is fixed but content varies. Adding NOT before LIKE reverses the filter, returning all rows that do not match the specified pattern.

0
ProgrammingDEV Community ·

What Is NPV and How Do You Calculate It? A Data Analyst Explains

Data analyst Michael Nocito published a practical guide to Net Present Value (NPV) on DEV Community on August 11, 2026, aimed at helping readers evaluate whether a project is financially worthwhile. NPV works by discounting each future cash flow back to its present-day value using a chosen rate, then summing those values and subtracting the upfront cost. The core principle is that a dollar received in the future is worth less than a dollar today, because money available now can be invested to earn returns in the meantime. Nocito demonstrates the method using a six-row worked example computed in SQLite and verified in pandas, covering discount factors, present values, and common calculation errors. A positive NPV indicates the project exceeds the required rate of return, while a negative result signals it falls short.