Can images or HTML code trigger spam filters?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

Yes. Image-heavy emails and sloppy HTML both light up rules inside content scanners like SpamAssassin, and once those rules add enough points, you land in spam.

The classic trap is the all-image email. Marketers paste a single JPG into the body, add a one-line caption, and call it done. Filters read that as evasion, because spammers used the same trick for years to hide pill ads and scam offers from text-based scoring. SpamAssassin ships a family of rules called HTML_IMAGE_ONLY_04 through HTML_IMAGE_ONLY_32, where the number is roughly the kilobytes of image with almost no text alongside. Each one adds points to the spam score. There is also HTML_IMAGE_RATIO_02 through 08 for emails where images dominate text. You can read the full rule list in the SpamAssassin rules documentation.

A safe working ratio is around 60 percent text to 40 percent image by volume, measured as readable copy versus image bytes. You do not need to hit that exactly. The point is that a human reading the rendered email should see actual sentences, not just a picture with a button. If your only text is "View in browser" and a footer address, you have an image-only email regardless of what your designer says.

The other big trigger is dirty HTML. Filters flag:

  • Broken or unclosed tags. Missing </td>, stray <font> wrappers, tables that never close. Gmail and Outlook both penalise emails that fail to parse cleanly.
  • Invisible text. White text on white background, or font-size:0, or display:none blocks stuffed with keywords. This used to be a spammer trick for tricking Bayesian filters. It still scores points today.
  • Tiny fonts. Anything under 4px reads as a hidden-content attempt.
  • Hidden links. Anchor text that says one thing while the href points somewhere unrelated. Bonus penalty if the link domain does not match your From domain.
  • Mismatched character encoding. Declaring UTF-8 in the header and then serving Windows-1252 in the body.

Google covers most of this in their sender guidelines: format messages according to the RFC 5322 and HTML standards, and do not hide content. Microsoft says the same in their Outlook.com policies.

A few practical checks before you hit send:

  1. View the email with images blocked. If it is blank or just a "download images" prompt, rebuild it with real HTML text.
  2. Always include a plain text alternative. Most ESPs auto-generate one. Make sure yours is not empty or just the URL.
  3. Run the HTML through a validator. W3C's validator catches broken tags. You can also pipe a test send through SpamAssassin via tools like Mail-Tester and read the rule hits directly.
  4. Keep total email size under 102KB. Gmail clips messages above that, which hides your unsubscribe link and your text content, and clipped emails get more complaints.
  5. Match your link domains to your From domain or to a clearly branded subdomain. Random shortener URLs trigger rules and look phishy to recipients.

None of this is about being pretty. It is about not looking like the patterns filters have learned to associate with junk. For more on how those patterns get scored, see what signals do spam filters look at and how spam filters decide if an email is spam. If you want the bigger picture on what these tools actually do, start with what is a spam filter.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Check if your design triggers spam filters.

I'm designing an email with [describe your layout: lots of product images / animated GIFs / minimal text]. Based on what triggers spam filters, is my approach risky? What's the safe ratio of text to images, and are there specific HTML patterns I should avoid?

Edit the yellow boxes, then send to the AI of your choice.