Quick Links

Most of the time, our email arrives without problems or quirks, but why do some arrive with nonsensical strings of characters as headers? Today's SuperUser Q&A post has the answer to a puzzled reader's question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

Photo courtesy of Judith E. Bell (Flickr).

The Question

SuperUser reader dpdt wants to know why he received an email with a nonsensical header:

I recently received an email with the following title:

why-do-some-emails-have-nonsensical-strings-of-characters-as-headers-01

Thinking that it might be malware, I ran a check with Malwarebytes, but it came up clean. Is there any legitimate reason for the title being a nonsensical string of characters?

Why do some emails have nonsensical strings of characters as headers?

The Answer

SuperUser contributor user313114 has the answer for us:

What you have is some header text encoded with a failed attempt at RFC 2047.

RFC 2047 is the standard governing the embedding of non-ASCII characters in email headers. It says that headers which do not comply (exactly) with the RFC 2047 standard should be displayed as-is rather than any decoding being attempted. So your email software is seeing the bad header and displaying it “correctly” (as required by the standard).

No mainstream software flouts RFC 2047 so badly as that, so it is probably coming from some dodgy bulk mailing software. The software is making encoded words too long (the line length limit is 76 characters), which is forbidden (RFC 2047 says “MUST NOT”).

Despite being too long, it can be decoded manually. It looks like some sort of recruiter spam:

why-do-some-emails-have-nonsensical-strings-of-characters-as-headers-02

Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.