Closed TrueShutDown closed 7 years ago
Can you send this email to me? sergey144010 gmail.com
I send e-mail to you from shutjunk (at) wp.pl. Check SPAM folder, because this message is ad.
I will sort this out.
Also this problem is in getBriefInfoMessages();
Try this and show me
$imap->getMessage(1);
$str = $imap->incomingMessage->header->subject;
$str = iconv('utf-8', 'iso-8859-2', $str);
var_dump($str);
Where do you put var_dump() ? You have Notepad++ program ? If you write in the script like this:
$imap->getMessage(1);
echo $imap->incomingMessage->header->subject;
And write the output to a file, like this:
php test.php > test.txt
And then open it in Notepad++. You will see the correct string. Same thing with this:
$imap->getMessage(1);
echo $imap->incomingMessage->header->body;
And choose the ISO 8859-2 encoding.
If you display var_dump() or echo() in a browser or console, then they need to specify iso-8859-2 encoding.
Check it out and write here.
Ok, I write in script
iconv('iso-8859-2', 'utf-8', $email->header->subject)
and this working.
maybe good idea is add option who allow recognize and auto convert body and subject to utf-8?
Thanks
The updated version of the code contains the encoding field here $imap->incomingMessage->message->html->charset
. It's all for now. Then we'll see.
You can also completely disable decoding and see how the original string looks.
getMessage($id, $decode = IncomingMessage::NOT_DECODE)
Ok, Thank you for support :)
Bad encoding in body and subject message.
Subject:
[subject] => B造skawiczna metoda odchudzaj帷a. Mo瞠sz schudn望 nawet 15 kg.
Correct:
[subject] => Błyskawiczna metoda odchudzająca. Możesz schudnąć nawet 15 kg.
Body:
(...)<title>P豉ski brzuch, smuk豉 talia - wystacz?2 tygodnie!</title>(...)
Correct:
(...)<title>Płaski brzuch, smukła talia - wystaczą 2 tygodnie!</title>(...)
Var dump: