php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

getHTMLBody() return html with message headers

Open vkamelin opened this issue 9 months ago • 1 comments

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):

  • OS: Ubuntu
  • PHP: 7.1

Sometims it happens with $message->getTextBody()

vkamelin avatar Apr 27 '24 06:04 vkamelin

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

vkamelin avatar Apr 27 '24 06:04 vkamelin