Mail header parsing

Russ Kepler <[email protected]>
Newsgroups gmane.comp.kde.users.pim
Message-ID <5980931.fmpY7KPtZ0@main>
I have some mail coming in from one site with one of those godawful "spam 
reports" in the header, it looks like this:

Content-Language: en-za
X-SA-Score: 0.2
X-SA-Report: Spam detection software, running on the system 
"smtpout-01.voxcore.co.za", has
 identified this incoming email as possible spam.  The original message
 has been attached to this so you can view it (if it isn't spam) or label
 similar future email.  If you have any questions, see
 The administrator of that system for details.
 
 Content preview:  blah blah blah [...]
 
 Content analysis details:   (0.2 points, 8.0 required)
 
  pts rule name              description
 ---- ---------------------- 
--------------------------------------------------
  0.2 AWL                    AWL: From: address is in the auto white-list
X-Originating-IP: 41.193.4.185
X-eGroups-Msg-Info: 2:3:4:0:0

When it's parsed the following Subject:, Date:, From: etc. are all missed.  
Since it happens with all the messages with this cruft inside I'm assuming 
that the parser is stopping on one of the lines that contain only a space 
(none are completely empty).  I expect that the leading and/or trailing spaces 
are being stripped before looking for the end of the header by detecting a 
blank line and that the blank stripping should happen after looking for a 
blank line (see RFC 822 3.1).

(For grins I pasted the complete header block into the code here:

http://www.mxtoolbox.com/emailheaders.aspx

and it parsed the missing headers out just fine.)

_______________________________________________
KDE PIM users mailing list
Subscription management: https://mail.kde.org/mailman/listinfo/kdepim-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.