php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

Querying for unseen messages with attachment from inbox replicates a message body in all other messages bodies fetched

Open germanocorrea-tiny opened this issue 3 years ago • 0 comments

Describe the bug Essentially, when I query for unseen messages from the INBOX folder, I receive the proper amount of unseen messages and their correct uid, but when some messages have an attachment, all messages bodies are the same. This only occurs when there is at least one message with an attachment.

Querying for all messages from INBOX folder works as intended.

I workaround this by fetching messages without the body, then performing another query to fetch a single message, for each one (using getMessageByUid), but this is not ideal.

Used config I'm using the default config, except for accounts, where I'm using the commented example for gmail config.

Code to Reproduce As simple as it gets:

$cm = new \Webklex\PHPIMAP\ClientManager("imap.php");
$client = $cm->account('gmail');
$client->connect();
$folder = $client->getFolderByName("INBOX");
$messages = $folder->messages()->unseen()->get();

Expected behavior Return all unseen messages properly.

Steps to reproduce bug

  • Have at least more than one unseen message in INBOX
  • Have at least one message unseen in INBOX with at least one attachment
  • Fetch messages according to above code

Desktop / Server (please complete the following information):

  • OS: Amazon Linux 2
  • PHP: PHP 7.4.28
  • Version ^3.2
  • Provider Gmail

I tried investigating the problem to see if I could fix it and create a pull request for you, but unfortunately I don't have the time for that right now.

If there is any more information I can provide, just ask!

Thanks for the attention.

germanocorrea-tiny avatar Apr 27 '22 12:04 germanocorrea-tiny