Skip to content

mb_decode_mimeheader() fails on emails with multiple references #51

@petar-djuric

Description

@petar-djuric

Describe the bug
I'm using laravel however this seems to be a php-imap issue so I will post it here. The connection used was gmail with the settings described in the wiki (app-password)

mb_decode_mimeheader() expects parameter 1 to be string, array given
on src/Header.php  private function decode($value)
on line 388

I have traced the issue back to 'References:' raw header

unknown

On normal emails, there is only one reference but some emails can have a hierarchy of emails in them so it picks up multiple references. This causes the public function rfc822_parse_headers($raw_headers) on line 171 to parse 'References:' as an array rather than a string.

To Reproduce
Steps to reproduce the behavior:

  1. use gmail connection (app password)
$client->connect();
       return $client->getFolders('folder name')->messages()->all()->get();
  1. emails with multiple references will fail on mb_decode_mimeheader()

Desktop / Server (please complete the following information):

  • OS: macos 10.15.7 (19H2)
  • PHP: 7.4.13

Additional context
This only happens when an email contains multiple 'References:' on a single reference the behaviour is normal with out any issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions