I have this code. This is from the Zend Reading Mail example .
$message = $mail->getMessage(1);
$foundPart = null;
foreach (new RecursiveIteratorIterator($mail->getMessage(1)) as $part) {
try {
if (strtok($part->contentType, ';') == 'text/plain') {
$foundPart = $part;
break;
}
} catch (Zend_Mail_Exception $e) {
}
}
if (!$foundPart) {
echo 'no plain text part found';
} else {
echo $foundPart->getContent();
}
What I can get is a message that works great. But trying to decode a message into something readable does not work. I tried Zend_Mime, imap_mime and iconv with no luck.
This is an example of what I get with $foundPart->getContent();
Hall = F3 heim = FAr
He must say "Halló heimúr"
What I would like is just a library where I could “push a button, get bacon” in practice. I mean, I just want to specify the library in the POP3 email field and receive the email in a readable form (without any encoding problems) and attachments.
imap_mime_header_decode()Gives me an array with the same data.
iconv_ mime_ decode()Does the same
- , - , (PHP/Python Perl)