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
629 stars 179 forks source link

Empty body when using gmail #445

Closed alphaolomi closed 2 years ago

alphaolomi commented 2 years ago

Describe the bug Empty body when fetching emails

To Reproduce Steps to reproduce the behavior:

  1. Install package on fresh laravel 9
  2. Integrate Gmail or other service
  3. Use Client facade to fetch emails
  4. When displaying the body is empty

Expected behavior Email body should be present in the body

Screenshots Problem is reproducible without screenshots

Desktop / Server (please complete the following information):

Additional context Connection is okay It fetches folders ok It fetches emails ok It failed to load messages body On the mail servers for this case Gmail it registers emails as read since the it assumes the body is read

alphaolomi commented 2 years ago

Great package and kudos to the author(s).

alphaolomi commented 2 years ago

How to reproduce Ref: https://github.com/Webklex/laravel-imap/issues/431#issuecomment-1236884534

  1. Create new project laravel new imap-demo && cd imap-demo

  2. install the package composer require webklex/laravel-imap Now the require of the composer.json is

 "require": {
        "php": "^8.0.2",
        "ddeboer/imap": "^1.14",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.19",
        "laravel/sanctum": "^3.0",
        "laravel/tinker": "^2.7",
        "php-imap/php-imap": "^5.0",
        "webklex/laravel-imap": "^4.0"
 },
  1. add the ENV variables For my case am using Gmail with App password

IMAP_HOST="imap.gmail.com" IMAP_PORT=993 IMAP_ENCRYPTION=ssl IMAP_VALIDATE_CERT=true IMAP_USERNAME="XXXXX@gmail.com" IMAP_PASSWORD="XXXXXX" IMAP_DEFAULT_ACCOUNT="default" IMAP_PROTOCOL=imap


4. I added a custom Artisan command `php artisan make:command ImapTestCommand`

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command; use Webklex\IMAP\Facades\Client;

class ImapTestCommand extends Command { /**

alphaolomi commented 2 years ago

Sorry guys, It works now

vikrantisk commented 1 year ago

Hi @alphaolomi , Can you please tell me how did you resolved this issue?

alphaolomi commented 1 year ago

Hello @vikrantisk, I recreated the project from scratch, used a fresh Mailbox for testing with minimal number of email, and my conclusion is issue https://github.com/Webklex/laravel-imap/issues/431 still exists in some cases