I'm in the process of replacing my home-grown header parser with the Chilkat plugin and got some issues from my collected cabinet of email horrors:
The following subject most likely isn't legal.
Subject: Nie mehr kalte Füße -
Beheizte Hausschuhe jetzt 60
% reduziert - Restposten -
"Nur noch 4,95 Euro - Solange "
der Vorrat reicht
Oddly the result is "Nie mehr kalte F" and the rest is missing.
I've got a mail where the mail body is in content-disposition:
Return-path: <bounces@cannon.fwdto.com> Envelope-to: xxx@yyy.com Delivery-date: Fri, 03 Jun 2005 10:02:31 +0100 Received: from mltk3.mailtrack.com ([195.68.228.215]) by mailcluster2.yyy.com with esmtp (Exim 4.34) id 1De84V-0006Bv-Nf for xxx@yyy.com; Fri, 03 Jun 2005 10:02:31 +0100 Message-Id: <3bsvom$7o1b1@ironport.mailtrack.com> Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-Mailer: MIME::Lite 2.117 (F2.72; T1.13; A1.55; B3.01; Q3.01) X-Mailer: Postman Email Date: Wed, 25 May 2005 17:16:50 UT Subject: CEWSS & My Canon To: xxx@yyy.com Lines: 42
Dear Customer,
'snip
Your Canon Team X-SA-Exim-Connect-IP: 195.68.228.215
I could parse this myself but the value of the header doesn't have the returns anymore. Which is quite correct except for this lovely mail here.
The code is quite simple:
Dim email As New Chilkat.Email
email.PreferredCharset = "iso-8859-1"
If not email.SetFromMimeText(OriginalHeader) Then
Globals.theErrorLog.DialogErrorProceed(kErrorParse + email.LastErrorText)
Globals.stopArchiving = True
end If
'loop through the header fields
For currentHeader as Integer = 0 To email.NumHeaderFields - 1
doTheParsing(email.GetHeaderFieldName(currentHeader), email.GetHeaderFieldValue(currentHeader))
Next
In doTheParsing I fish out the individual header values.
As usual: Xojo 2016r4, Chilkat from July 2016, Mac OS 10.11.
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals