-
-
Notifications
You must be signed in to change notification settings - Fork 183
Closed
Labels
Description
I want to get all the emails except those which are received from '@global.com' domain. How to exclude the emails received from 'xyz@global.com' and get all the emails ?
public function index(Request $request){
//Artisan::call('email:parser');
try {
$oClient = new Client([
'host' => env('IMAP_HOST', 'outlook.office365.com'),
'port' => env('IMAP_PORT', 993),
'encryption' => env('IMAP_ENCRYPTION', 'ssl'),
'validate_cert' => env('IMAP_VALIDATE_CERT', true),
'username' => env('IMAP_USERNAME', '****@**.com'),
'password' => env('IMAP_PASSWORD', 'xyz'),
]);
$oClient->connect();
$aFolder = $oClient->getFolder('ProcessedMails');
$aMessage = $aFolder->getMessages();
$PAGE_RECORDS = 5;
$page = 1;
if (!empty($aMessage)) {
foreach ($aMessage as $oMessage) {
$MessageBody = $oMessage->getHTMLBody(TRUE);
//$from = contains($MessageBody);
//$MessageBody = $oMessage->getHTMLBody(FALSE)->getFrom('xyz@global.com');
}
}
} catch (Exception $ex) {
Log::error('Error << ' . $ex->getMessage());
throw new \Exception($ex->getMessage(), $ex->getCode());
}
}
}