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

Message from gmail with wrong UID #419

Closed igmacedo closed 3 years ago

igmacedo commented 3 years ago

Messages are loaded but cannot be searched individually, the problem is with the UID, although it is removed from the inbox, when searching the message it is not found and this is not related to the fact that the identifier is dynamic. Messages with a low UID like 200 return the wrong content and messages with a high UID like 200,000, which is what I'm looking for, are not found, all the ids are wrong and that only happens with Gmail.

The method below returns null:

\Webklex\IMAP\Facades\Client::account('default')->connect()->getFolders()->all()[0]->query()->where('uid', $uid)->limit(1)->get()

image

This other method returns: "unique id not found"

\Webklex\IMAP\Facades\Client::account('default')->connect()->getFolder('INBOX')->query()->getMessage($uid);

The UID exists, it is returned in the input box with the following code using foreach:

\Webklex\IMAP\Facades\Client::account('default')->connect()->getFolder('INBOX')->messages()->all()->setFetchBody(false)->paginate(); Also, a date lookup was attempted instead of the UID, however the date lookup returns the wrong message and the documentation deviates from the pattern used, the headers return something like "2021-10-22 23:15:04" and not "2021.10. 22" as suggested in the examples.

What do you suggest to solve the problem?


This has been seen, tested and does not solve: https://github.com/Webklex/laravel-imap/issues/157

igmacedo commented 3 years ago

This can help to contextualize the issue: https://developers.google.com/gmail/imap/imap-extensions#access_to_the_gmail_unique_message_id_x-gm-msgid

Webklex commented 3 years ago

Hi @igmacedo , many thanks for your excellent and well researched issue report! Unfortunately this is the wrong repository. The responsible repository is webklex/php-imap. This repository is "just" a wrapper. Please go ahead and create a new issue over there: https://github.com/Webklex/php-imap/issues/new?assignees=&labels=&template=bug_report.md.

Best regards & thanks again,

igmacedo commented 3 years ago

@Webklex The problem was resolved in: https://github.com/Webklex/php-imap/issues/176 but the update does not work with Laravel-imap. Is it possible to update or do I even need to use the pure php library? image

Webklex commented 3 years ago

Hi @igmacedo , in general webklex/php-imap v3.0.0-alpha is compatible with webklex/laravel-imap. However it is currently limited by the ^2.4 constraint, which prevents an upgrade above or egal to 3.0.0.

You can get around it with something like this inside your composer.json:

{
    "name": "webklex/test",
    "type": "project",
    "require": {
        "webklex/laravel-imap": "^2.4",
        "webklex/php-imap": "3.0.0-alpha as 2.7.2"
    },
    "authors": [
        {
            "name": "John Smith",
            "email": "john@example.com"
        }
    ]
}

Of course you could use webklex/php-imap as a standalone. webklex/laravel-imap just provides a handy wrapper (such as a provider and facade) to it :)

Best regards,