Reputation:
I am using laravel imap package for email setup for receive mailbox.
use this https://github.com/Webklex/laravel-imap#installation package, but i don't understand how it works or test. If anybody for help ?
Upvotes: 1
Views: 17287
Reputation: 156
Assuming you have already installed the package and set your environment variables in .env
Here is an example of how to get all unseen messages from Inbox. (check the API Docs for more available methods or classes) https://github.com/Webklex/laravel-imap#documentation
$oClient = Client::account('default'); // defined in config/imap.php
$oClient->connect();
// get all unseen messages from folder INBOX
$aMessage = $oClient->getUnseenMessages($oClient->getFolder('INBOX'));
foreach ($aMessage as $oMessage) {
// do something with the message
}
Upvotes: 4