PHP Classes

MIME message decoding error

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  MIME message decoding error  >  (Un) Subscribe thread alerts  
Subject:MIME message decoding error
Summary:I occasionally receive this error
Messages:6
Author:Scott Taylor
Date:2009-09-30 19:55:14
Update:2009-11-12 22:52:18
 

  1. MIME message decoding error   Reply   Report abuse  
Picture of Scott Taylor Scott Taylor - 2009-09-30 19:55:14
I have been using the mime parser class for some time. Every once in a while I will get the error "MIME message decoding error: reached a premature end of data at position -1" or "MIME message decoding error: unexpected decoded message part type MessageStart in state 5 at position -1".

When I've researched the issue it seems that components within the text/plain portion of the email throw off the parsing process. If I go into the body of the email and remove components of the text/plain body and attempt to re-parse the message it works.

I'm guessing that this may be because the body is defined as quoted-printable and the parser process believes the data is longer than 76 characters (which it isn't).

Is this a problem others have faced and is there a plausible workaround?

Thanks
Scott

  2. Re: MIME message decoding error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-09-30 21:25:20 - In reply to message 1 from Scott Taylor
I would need a sample message to reproduce the problem in order to see what is the matter and fix it.

  3. Re: MIME message decoding error   Reply   Report abuse  
Picture of Gary R Gary R - 2009-10-24 11:28:00 - In reply to message 2 from Manuel Lemos
I have this problem too
Here you go for an example file:

bit.ly/iPHzD

"MIME message decoding error: unexpected decoded message part type MessageEnd in state 1 at position -1"


  4. Re: MIME message decoding error   Reply   Report abuse  
Picture of Gary R Gary R - 2009-10-24 12:02:24 - In reply to message 3 from Gary R
I've noticed that the error occurs when the message boundary doesn't end with a double '--'

I don't know if this was a bug in the apple mailer or not.

So in the linked message it ends with:

--Apple-Mail-18--1009561256

but should end with

--Apple-Mail-18--1009561256--

perhaps?

  5. Re: MIME message decoding error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-10-25 23:14:55 - In reply to message 3 from Gary R
Yes, that message is incorrectly ended.

I just uploaded a version of the MIME parser class that tolerates that case.

  6. Re: MIME message decoding error   Reply   Report abuse  
Picture of Scott Taylor Scott Taylor - 2009-11-12 22:52:19 - In reply to message 5 from Manuel Lemos
Thank you Manuel. This resolved the issue that I was encountering. Your efforts are greatly appreciated.