-
- Notifications
You must be signed in to change notification settings - Fork 183
Closed
Labels
OutlookRelated to OutlookRelated to OutlookbugSomething isn't workingSomething isn't workingvalidated
Description
idle function not returning any message when new mail comes
Config:
'custom' => [ 'host' => 'outlook.office365.com', 'port' => 993, 'encryption' => "ssl", 'validate_cert' => true, 'username' => 'email@my_domain.com', 'password' => get_access_token(), 'authentication' => "oauth", ], // halper_functions.php function get_access_token() { $tenantId = env("TENANT_ID"); $clientId = env("CLIENT_ID"); $clientSecret = env("CLIENT_SECRET"); $guzzle = new \GuzzleHttp\Client(); $url = 'https://login.microsoftonline.com/' . $tenantId . '/oauth2/v2.0/token'; $token = json_decode($guzzle->post($url, [ 'form_params' => [ 'client_id' => $clientId, 'client_secret' => $clientSecret, 'scope' => 'https://outlook.office.com/IMAP.AccessAsUser.All', 'grant_type' => 'password', 'username' => 'email@my_domain.com', 'password' => 'password', ], ])->getBody()->getContents()); $accessToken = $token->access_token; return $accessToken; }custom command:
public function handle() { $client = Client::account("custom"); try { $client->connect(); } catch (ConnectionFailedException $e) { Log::error($e->getMessage()); return 1; } try { /** @var Folder $folder */ $folder = $client->getFolder("INBOX"); } catch (ConnectionFailedException $e) { Log::error($e->getMessage()); return 1; } catch (FolderFetchingException $e) { Log::error($e->getMessage()); return 1; } try { dump("listening..."); $folder->idle(function ($message) { dump($message); // this doesn't run }, 1200, true); } catch (ConnectionFailedException $e) { Log::error($e->getMessage()); return 1; }but when i get messages manually it works
Route::get("test", function () { $client = Client::account("custom"); try { $client->connect(); } catch (ConnectionFailedException $e) { throw $e; } try { /** @var Folder $folder */ $folder = $client->getFolder("INBOX"); } catch (ConnectionFailedException $e) { throw $e; } catch (FolderFetchingException $e) { throw $e; } dump($client->getFolder("INBOX")->examine()); dump($client->getFolder("INBOX")->messages()->all()->limit(5)->get()); dd("done"); });- OS: CentOs (prod), win 11 (dev)
- PHP: 8.1
- webklex/laravel-imap : 2.4
- Provider: Outlook
Webklex and MouMoutMan
Metadata
Metadata
Assignees
Labels
OutlookRelated to OutlookRelated to OutlookbugSomething isn't workingSomething isn't workingvalidated

