Webklex / php-imap

PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the "new" oAuth authentication process as well.
https://www.php-imap.com
MIT License
308 stars 145 forks source link

getHTMLBody() return html with message headers #491

Open vkamelin opened 5 months ago

vkamelin commented 5 months ago

Simple code from example:

$client->connect();

//Get all Mailboxes
/** @var \Webklex\PHPIMAP\Support\FolderCollection $folders */
$folders = $client->getFolders();

//Loop through every Mailbox
/** @var \Webklex\PHPIMAP\Folder $folder */
foreach($folders as $folder){

    //Get all Messages of the current Mailbox $folder
    /** @var \Webklex\PHPIMAP\Support\MessageCollection $messages */
    $messages = $folder->messages()->fetchOrderDesc()->paginate(5, 1)->all();

    /** @var \Webklex\PHPIMAP\Message $message */
    foreach($messages as $message){
        echo $message->getSubject().'<br />';
        echo 'Attachments: '.$message->getAttachments()->count().'<br />';
        echo $message->getHTMLBody();
    }
}

$message->getHTMLBody() return html with message headers.

Desktop / Server (please complete the following information):

Sometims it happens with $message->getTextBody()

vkamelin commented 5 months ago

And in one of s messages getHTMLBody() return.. I don't know.. some bytes. It's attachment or may be something wrong with encoding.