Skip to content

No body parts when opening a Message from icloud #510

Open
@lamigne

Description

@lamigne

Describe the bug
When fetching a Message object from a icloud imap server, the message body part is empty, while the headers loads totally fine.
The Structure raw property is "" and parts is []

Used config
imap server : icloud
composer "webklex/php-imap": "dev-master#6d999438d29ed0bb920cd897b200a3a5fd6b6380" (to avoid composer requirements and other libraries check, #498 )

Code to Reproduce
The troubling code section which produces the reported bug.

 $cm = new ClientManager();
  $params = [
      'host'          => 'imap.mail.me.com',
      'port'          => 993,
      'encryption'    => 'ssl',
      'validate_cert' => true,
      'username'      => $username,
      'password'      => $password,
      'protocol'      => 'imap',
  ];
  
  $client = $cm->make($params);
  $client->connect();

  $folder = $client->getFolderByName('INBOX');

 if ($folder === null) {
            return false;
        }

        $messages = $folder
            ->messages()
            ->setFetchOrderAsc()
            ->all()
            ->since(new DateTimeImmutable('-10 years'))
            ->limit(10)
            ->get();

        for ($i = 0; $i < $messages->count(); ++$i) {
             $message = $messages[$i];
             print_r($message->getStructure());
        }

Expected behavior
$message->getStructure() should return a correct raw value with parsed parts array.

Desktop / Server (please complete the following information):

  • OS: mac OS 14.5
  • PHP: 8.3
  • Version: dev-master#6d999438d29ed0bb920cd897b200a3a5fd6b6380
  • Provider: icloud

Additional context
Only the body parts are empty, all the other features tested are working.
The package works fine when used with google (with OAuth2 of course)

As a temporary solution i use Ddeboer/imap for this icloud mailbox as it is not requiring OAuth token (yet)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions