I am using Laravel-imap package (https://github.com/Webklex/laravel-imap) to fetch emails using imap.
I'm able to make a successful connection, able to fetch folders and emails, all set in that part.
However, I need to ignore drafted emails but I'm not able to detect that if a message is draft using code because email objects seem to have similar properties. I am testing using my Gmail account imap settings.
Here is the code I'm using. Any kind of help would be appreciated. Thanks
$oClient->connect();
$aFolder = $oClient->getFolders();
foreach($aFolder as $oFolder){
$aMessage = $oFolder->messages()->all()->get();
/** @var \Webklex\IMAP\Message $oMessage */
foreach($aMessage as $oMessage){
print_r($oMessage);
}
}