php-imap: found a bug that causes body to be empty

Describe the bug $message->getHTMLBody(); returns null

Used config default config 100%

Code to Reproduce

$messages = $folder->messages()->all()
      ->unseen() // THIS CAUSES THE ERROR //IF THIS IS REMOVED PROBLEM SOLVED
      ->limit(1,1)// I have only one email anyways
      ->get();
foreach($messages as $message){
     $message->hasHTMLBody();//returns null
}

Expected behavior must return an html content as the name says Screenshots If applicable, add screenshots to help explain your problem.

Desktop / Server (please complete the following information):

  • OS: Windows 10
  • PHP: 8.1
  • Version “webklex/laravel-imap”: “^4.0” & webklex/php-imap": “^4.0”
  • Provider Gmail

Additional context please fix this bug and stay the best thing in the internet !! and thanks for reading all this

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Hello, I’ve got the same problem. I tried changes from https://github.com/Webklex/php-imap/pull/233. It has pretty much solved this problem. @Webklex When can we expect update of library?

In our case here is what happens (the issue with Azure seems to be fixed by settings proper permissions for the app): https://github.com/Webklex/php-imap/issues/320#issuecomment-1404898745

Hello, i’m facing the same issue and it seem that on Gmail if the mail is unread, the body will be empty. However the PR #233 seems to fix this problem, maybe @Yasser-Chen you can try the fix proposed in the PR and see if it work for you as well ?