Are email headers case sensitive?
For example, is Content-Type
different from Content-type
?
According to RFC 5322, I don't see anything about case sensitivity. However, I'm seeing a problem with creating MIME messages using the PEAR Mail_mime module, and everything is pointing to the fact that our SMTP server uses Content-type
and MIME-version
instead of Content-Type
and MIME-Version
. I tried using another SMTP server (like GMail), but unfortunately our web servers are firewalled pretty tightly.
An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value. Whitespace before the value is ignored.
Unlike passwords, email addresses are not case sensitive. Whether or not you add capitals, your email server will read it the same way as long as the numbers and letters match your official email address.
Gmail addresses are not case sensitive, meaning the email service doesn't distinguish between versions of the address with or without capitalized letters, so long as the spelling is the same.
The http header names are case-insensitive. So “Content-Type” is equivalent with “content-type”.
RFC 5322 does actually specify this, but it is very indirect.
Section 1.2.2 says:
This specification uses the Augmented Backus-Naur Form (ABNF) [RFC5234] notation for the formal definitions of the syntax of messages.
In turn, Section 2.3 of RFC 5234 says:
NOTE:
ABNF strings are case insensitive and the character set for these strings is US-ASCII.
So when RFC 5322 specifies a production rule like this:
from = "From:" mailbox-list CRLF
It is implicit that the "From:" is not case-sensitive.
[update]
As for Content-Type and MIME-Version, they are specified by the MIME spec (RFC 2045). That in turn refers to the BNF described by the original RFC 822, which (luckily) also makes it clear that these literal strings are case-insensitive.
Bottom line: According to the spec, Email headers are not case-sensitive, so it sounds like your mail server is buggy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With