Hello Manuel,
Thanks for your fast response.
I am not sure, if the script is the problem, but sure - I can share it (here?) - the important part is only a few lines taken from your test.php:
$data=<full_gmail_message_as string>;
$mime=new mime_parser_class;
$mime->mbox = 1;
$mime->decode_bodies = 1;
$mime->ignore_syntax_errors = 1;
$mime->track_lines = 0;
$mime->use_part_file_names = 0;
$mime->extract_addresses = 1;
$parameters=array('Data'=>$data);
$deco=$mime->Decode($parameters, $decoded);
if ($deco) {
var_dump($decoded[0]);
$res=$mime->Analyze($decoded[0], $results);
var_dump($results);
}
The problem could be the $data, which is the Google Gmail message - starting like this:
From 1720730285230359859@xxx Sat Jan 01 05:51:18 +0000 2022
X-GM-THRID: 1720730285230359859
X-Gmail-Labels: =?UTF-8?Q?Skrzynka_odbiorcza,Wa=C5=BCne,Otwarte,Kategoria:_aktualizacje?=
Delivered-To:
[email protected]
Received: by 2002:a4a:6d49:0:0:0:0:0 with SMTP id w9csp10425847oof;
Fri, 31 Dec 2021 21:51:18 -0800 (PST)
X-Received: by 2002:a2e:8899:: with SMTP id k25mr5669145lji.98.1641016278131;
Fri, 31 Dec 2021 21:51:18 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1641016278; cv=pass;
d=google.com; s=arc-20160816;
b=cQDFr7bFa1J5dPlKFGuOxchdehq1sbDj4r+f6R9r6oYm2Fvvkt9FyWd+n/pR2cnAER
yv1u44+QnAK8mrIWRDVE+NN+w3lrInS+ZOG/lkUi09bldSk5ThRQW/M20mpHjvI52ZQa
er75d2afdlmN8xFELnhlW6N3HEN7HuD2ubKycCiMvY9LbfItza7CUFeYp4ICHx9bxI6V
IEKS3QbnFFyuMaqZxeezFvaJ9ixX8MwT1my7rYip3lNlCbZA+G+LOCpr+rFvgZ4qMFXE
l8uAgjdf9njSXcC33my70/iBhO+eYP2kFe73UzQsOu+hDWTaP5K/nr31Kb8khunwt378
OGzQ==
(...)
(plus the rest of the message)
and your parser gives the result as follows:
---
$decoded[0] = Array
(
[Headers] => Array
(
[from ] => 1720730285230359859@xxx Sat Jan 01 05:51:18 +0000 2022
)
[Parts] => Array
(
)
[Position] => 0
[Body] => (...)
[BodyPart] => 1
[BodyLength] => 45816
)
$results = Array
(
[Type] => text
[Description] => Text message
[Data] => (...)
)
All the message body is in [Body] and in [Data]. Is that correct?
I would prefer to get some data decoded, but it is obvious, I guess. ;-)
Regards,
Maciej.