Is HTML content permitted in email header values?

In the process of troubleshooting an email message display issue, I noticed that an email header contained HTML.

Example:

From: <bob@foo.com>
To: <john@foo2.com>
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: <slkdsjflksdjflkslsjldkfjlsd-sldkfjslkdjfl@foo.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?

Answer

Where does the “Message” header come from? Does the message contain a body or did that somehow get stuffed into the “Message” header? “Message” isn’t a standard IMF header defined in RFC 5322 and it isn’t in IANA’s permanent or provisional lists. There might be a mail reader somewhere that interprets it, but for the most part “Message:” may as well read “X-this-will-likely-be-ignored:”

Attribution
Source : Link , Question Author : Mike B , Answer Author : Community

Leave a Comment