Gmail 554 5.6.0: mail message is malformed

554 5.6.0Malformed message not acceptedPermanent: retrying will not helpFrom Gmail and Google Workspace

Typical wording
554 5.6.0 Mail message is malformed. Not accepted. - gsmtp

What it means

RFC 3463 defines 5.6.0 as “other or undefined media error”: the receiving system could not process the message content as sent. Gmail uses it when the structure of the message, such as MIME boundaries, header syntax, or line formatting, is broken badly enough that it cannot parse or safely scan it. The text usually reads like the example.

It is almost always a bug in whatever produced the message, a homemade script or a misconfigured library, rather than a mail server policy. Since the code is permanent and the fault is in the bytes themselves, the same message will fail every time until the generator is fixed.

Likely causes

  • A multipart message whose boundary string does not match the one declared in Content-Type.
  • Duplicate single-instance headers, such as two From or two Subject lines.
  • Raw 8-bit or non-ASCII headers without proper encoding.
  • Lines longer than the 998-character limit from RFC 5322, often from minified HTML.

How to fix it

  1. Save a copy of the raw message as your software produces it and inspect the headers and MIME parts.
  2. Use a maintained mail library to build messages rather than concatenating strings by hand.
  3. Encode long HTML bodies with quoted-printable or base64 so no line exceeds 998 characters.
  4. Validate headers: exactly one From, one Date, and a valid Message-ID.

Checks that apply

  • Email Header Analyzer Parses the header block and flags duplicates and syntax problems that Gmail would reject.
  • MailFlow Monitor Sends a monitored test so you can confirm the fixed generator now reaches Gmail.

The classification runs without network lookups and we never store your paste.

FAQ

Why do other providers accept the same message?
Some receivers are more lenient. Gmail is strict because malformed mail is a common way to slip malware past scanners.
Is this a problem with my server or my app?
Usually the app that composed the message. The MTA rarely rewrites structure.

Google Postmaster Tools Google email sender guidelines

All 191 bounce codes