Below is the simplest, most-reliable way to keep every message whose HTML refers to assets on stackcdn.com out of your Inbox.
Nothing has to be installed; it’s just a native Gmail filter.
Step-by-step (takes < 1 min)
-
Open Gmail on a desktop browser.
-
In the search bar, click the downward ▾ “Show search options” icon.
-
In the “Has the words” box paste:
stackcdn.com
Optional refinements you can add on the same line:
• Only messages that actually contain an inline/remote image:
stackcdn.com has:images
• Exclude any conversation from people you know is legitimate:
stackcdn.com has:images -from:myfriend@example.com
-
Press “Search” first to make sure only the unwanted messages appear.
-
Click “Create filter”.
-
Tick the action(s) you want, e.g.
☑ Skip the Inbox (Archive it)
☑ Delete it (if you really never want to see them)
☑ Apply the label ▶ “StackCDN spam” (handy for later review)
-
(Optional) Tick “Also apply filter to X matching conversations” so old mail is handled too.
-
Hit “Create filter”.
That’s it — every future email whose HTML contains the string “stackcdn.com” (the way embedded images are referenced) will be treated according to the action(s) you chose.
Why this works
• Gmail’s filtering engine indexes the raw message source, not just the visible text.
When an email contains <img src="https://stackcdn.com/..."> that literal URL is present in the body, so the text search matches.
• No regular expressions are needed; a plain substring match is enough.
• The added has:images operator simply limits matches to messages Gmail detected as containing image tags.
Limitations / things to know
- If the sender obfuscates the domain (e.g., via a redirect, base64-encoded data-URI, or a different CDN hostname) this specific filter won’t match—add those variants if you later see them (e.g.,
stackpathcdn.com).
- Gmail filters cannot inspect remote content after a message is delivered; they rely solely on what’s in the raw email when it arrives.
- Filters run top-to-bottom; if you have another filter that already deletes or archives the message earlier, the second filter won’t fire.
Need something more granular?
You can chain conditions with “OR” or parentheses, e.g.:
(has:images (stackcdn.com OR stackpathcdn.com)) -label:important
but for most cases the single keyword approach above is the quickest win.
Happy (un)filtering! 📨🚫