-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"failed to read - connection closed?" error when trying to query successful connection #259
Comments
Hi @JustinLardinois , /** @var \Webklex\PHPIMAP\Client $client */
$client->getConnection()->enableDebug(); There is also a new version available (released 10min ago). I recommend you update before you continue debugging :) Best regards & happy coding, |
Thank you. I've updated to 4.0.0. I'm still having this issue, but the error message is now "empty response." Here's the debug output:
|
This looks like you've enabled If
Is the command send to the server.
Is the received response.
Here is an example what to expect, if you call: /** @var \Webklex\PHPIMAP\Client $client */
$client->connect();
$inbox = $client->getFolder("INBOX");
$messages = $inbox->query()
->leaveUnread()
->unseen()
->from('example.com')
->since(\Carbon\Carbon::now()->subDays(1))
->get();
Best regards, |
I played around a bit, I think I was actually enabling debug too early. I was previously enabling it directly after the
|
Interestingly |
I don't know if this helps, but I've been playing around with the library on two different accounts, and I'm only seeing these issues for one of them. In both cases I'm using app passwords as recommended. |
If you test both accounts in an isolated environment - do you still get the same error? Perhaps some surrounding conditions (unrelated to this library) fail, which causes |
Alright, I created a standalone script that's just as follows: $clientManager = new ClientManager();
$client = $clientManager->make([
'host' => 'imap.googlemail.com',
'port' => 993,
'encryption' => 'ssl',
'validate_cert' => true,
'username' => '[email protected]',
'password' => 'password',
'protocol' => 'imap'
]);
try {
$client->connect();
} catch (ConnectionFailedException $e) {
die('Unable to connect to [email protected]');
}
$client->getConnection()->enableDebug();
$inbox = $client->getFolderByName('INBOX');
$messages = $inbox->query()
->leaveUnread()
->unseen()
->since(\Carbon\Carbon::now()->subDays(1))
->limit(10)
->get(); And tweaked the credentials for both of the accounts I was testing with. The first account that I haven't had any problems with worked fine. I've attached some debug output trimmed for length and edited for sensitive information: first-account.txt For the second account, I still have the same issue:
|
Hi @JustinLardinois , |
I suppose that's a potential cause—the account I'm having issues with is an inbox that's regularly accessed by several people at my company. Though I'm pretty sure everyone is accessing it through the Gmail.com webapp, not a separate IMAP client. I'm certainly not an IMAP expert so I don't know whether that would be related. The only thing that comes to my mind is they're using different MFA methods. The account that works is using an authenticator app; the one that doesn't is using SMS MFA. I don't see why that would matter for IMAP, but something to think about. I did try temporarily disabling SMS MFA on the account that was having issues, but turns out Google only supports app passwords if you have MFA enabled, so that didn't help. |
Describe the bug
I'm able to successfully create a connection, but then I'm getting a "failed to read - connection closed?" error when I try to query for messages.
Used config
Using default config
Code to Reproduce
Expected behavior
The query will be successful and my application will continue execution
Screenshots
N/A
Desktop / Server (please complete the following information):
Additional context
Same error as #215, but I don't know if it's a related issue or not. I saw the comment on that issue asking for debug output, but I couldn't figure out how to enable that.
The text was updated successfully, but these errors were encountered: