PHP Classes

Failed to parse single part base64 content

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Failed to parse single part base64...  >  (Un) Subscribe thread alerts  
Subject:Failed to parse single part base64...
Summary:The parser fails to decode single part, base64 encoded, text con
Messages:2
Author:Kieran
Date:2021-01-21 18:19:07
 

  1. Failed to parse single part base64...   Reply   Report abuse  
Picture of Kieran Kieran - 2021-01-21 18:19:07
The parser fails to decode single part, base64 encoded, text content which is longer than 8000 characters (the default buffer length).

$mimeParser = new mime_parser_class;
$mimeParser->ignore_syntax_errors = 1;

$mimeParser->Decode(['File' => '...', 'SaveBody' => '...'], $decoded);

The parser reads in chunks of 8000 and ends up partially parsing the base64 encoded content. It detects the partial body and attempts to decode it. It then decodes the rest of the body separately which results in broken base64 decoded data.

It should really only decode once it's got all the data.

@Manuel I've emailed you a copy of the email which causes the issue.

  2. Re: Failed to parse single part base64...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-01-21 19:51:40 - In reply to message 1 from Kieran
OK, give me some time to look into this so I can find how what is going on.