What is an invalid header?
Still have a question, spotted an error, or have a better explanation or a source we should cite?
An invalid header is an email header that breaks the formatting rules set by RFC 5322, the standard that defines how email messages should be structured. When your email has invalid headers, mailbox providers might reject it outright, route it incorrectly, or flag it as spam.
What makes a header invalid? A few common culprits: missing colons after field names, illegal characters (like line breaks where they don't belong), duplicated fields that should only appear once (like multiple "From" lines), or fields that violate length limits. If you've ever seen a bounce message mentioning "malformed header" or "syntax error", that's what happened.
Most senders never write headers by hand. Your ESP handles that for you. But invalid headers can still sneak in if you're manually constructing emails via SMTP, if you're using a custom integration that doesn't sanitize inputs properly, or if you're migrating from an old system with legacy formatting. Developers building transactional email systems are the most likely to hit this.
If you suspect invalid headers, you can check the raw email source. Gmail, Outlook, and most other mailbox providers let you view the full email headers and source code. Look for fields that don't have colons, line breaks in weird places, or duplicate "From" lines. If you're building your own email system, test every custom header before sending to real recipients. And if you're using an ESP, this shouldn't be a problem unless you're doing something custom.
Need to debug headers quickly? Our free Email Header Analyzer will parse the raw headers and flag anything that doesn't match RFC 5322. Or if you're mid-crisis and emails are bouncing, our SOS hotline is free (and we actually pick up).
Contributors
Who worked on this answer
Every name links to their profile. Every company links to their site. Real people, real accountability.