In the process of troubleshooting an email message display issue, I noticed that an email header contained HTML.
From: <email@example.com> To: <firstname.lastname@example.org> Date: 11 Feb 13 12:00:23 Subject: Foo Test Message: <html><head><meta http-equiv="Content-Language" content="en-us" <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Foo Test 123</title><body>Hi Message-ID: <email@example.com>
The message header is added by an upstream server that I don't manage. The original issue I was seeing was that the HTML text in the header was missing a tag so the email reader thought that the rest of the message (including other headers) were part of the message body (which resulted in the mime source showing up in the body instead of the rendered HTML.
This seems definitely wrong to me - I can't imagine any scenario where having HTML in the headers itself would be helpful. That said, I can't seem to find the section in the RFCs that explicitly define what can (or cannot) be in headers. Can someone point me in the right direction?
Specifically I want to know: Are there any restrictions on what type of content can be placed in email headers and what type of characters can be specified in header names/values?