login about faq

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:

  1. 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.

  1. 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

asked Dec 30 '16 at 09:49

bwill's gravatar image

bwill
256


For the first problem (where the Subject begins with "Nie mehr kalte Füße") I'd need to have the .eml so I could reproduce the problem by loading it via LoadEml.

For the 2nd problem, I'm not sure there's anything that can be done. MIME headers lines must be terminated by CRLF line endings. (Chilkat can deal with CR-only or LF-only line endings, but there must be some line ending to mark the end of one header and the start of another..)

link

answered Dec 30 '16 at 16:03

chilkat's gravatar image

chilkat ♦♦
12.5k317361454

Beatrix,

Thanks for sending the MIME to me..

I found the problem -- the line endings for the mime.txt were bare CR's. The line endings for headers in any MIME file, regardless of operating system, should be CRLF.

Chilkat handles LF-only line endings, and also auto-corrects as much "garbage" as possible. I made changes to auto-correct this case also, but I can't immediately get a new build out to you because of the time required to produce Xojo builds.

(I'm working on internal systems to better be able to quickly get new builds out. It's easy to produce new builds for .NET, ActiveX, C++, etc. because and individual build involves only a single operating system. Producing a new build (i.e. download) for Xojo involves building and gathering the DLLs/.so's for several operating systms, and that's why it's more time-consuming..)

link

answered Jan 02 at 12:47

chilkat's gravatar image

chilkat ♦♦
12.5k317361454

edited Jan 02 at 12:49

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17

Asked: Dec 30 '16 at 09:49

Seen: 393 times

Last updated: Jan 02 at 12:49

powered by OSQA