falconzy/EmailService — pull request #1 by bcronje (2013-07-03 23:22:30+00:00)
Title: Accept header lines with only spaces

RFC 5322 defines "The body is simply a sequence of characters that follows the header section and is separated from the header section by an empty line (i.e., a line with nothing preceding the CRLF)."

So theoretically it is valid to have a header line with only spaces, and some clients do this. Here is an example snippet, notice the line with whitespace only in the References header field:

From: Abuse
Subject: Test
Thread-Topic: Test
Thread-Index: Ac3ZPlcIvhfQqIxFRAum7VW4xkPwpwAAAWXwAAAAKyAAAAAtgAAAAC1A
Return-Receipt-To:
Message-ID:
References:

Content-Language: en-ZA
Content-Type: multipart/related;
boundary="_014_FC5D5D40127C2E44814AEA5DD9C4EB860124A61DMWCPTMBX01_";
type="multipart/alternative"
MIME-Version: 1.0

--_014_FC5D5D40127C2E44814AEA5DD9C4EB860124A61DMWCPTMBX01_
Content-Type: multipart/alternative;
boundary="_000_FC5D5D40127C2E44814AEA5DD9C4EB860124A61DMWCPTMBX01_"