Webklex / laravel-imap

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.
https://www.php-imap.com
MIT License
641 stars 182 forks source link

Subject encoding is sometime not what's expected #410

Closed Naghal closed 3 years ago

Naghal commented 3 years ago

Describe the bug Sometimes, the subject is not what expected, As an example, I have an email in gmail web browser with subject Maj Vidéotron. When calling $message->getSubject(), I am getting the subject: MAJ =?utf-8?b?Vmlkw6lvdHJvbg==?=. It is the same subject no matter what decoder option is set in the decode.message.subject config. (utf-8, iconv and mimeheader)

To Reproduce Steps to reproduce the behavior: Connect to a mailbox then:

 $this->client->connect();
 $folder = $this->client->getFolder('INBOX');
$unseenMessages = $folder->query()->unseen()->get();

foreach($unseenEmails as $email) {
    dd($email->getSubject())
}

Expected behavior The subject returned by getSubject() should be Maj Vidéotron.

Screenshots image raw subject header: image

Desktop / Server (please complete the following information):

Webklex commented 3 years ago

Hi @Naghal , many thanks for your report.

Please update your webklex/php-imap dependency to the latest release (>2.7.0). This will hopefully solve the problem. If not, please head over to the webklex/php-imap repository and create a new issue.

Best regards,