$strFromEmail = 'testir@gmail.com';
$arrayFrom = imap_search($inbox, 'FROM "' . $strFromEmail . '"'', SE_UID);
$arrayInvoice = imap_search($inbox, 'SUBJECT "INVOICE"', SE_UID);
if((!empty($arrayFrom)) && (!empty($arrayInvoice)))
{
$emails = array_intersect($arrayFrom, $arrayInvoice);
}
ASKER
$arrayFrom = imap_search($inbox, 'FROM \"' . $strFromEmail . '\"'', SE_UID);
ASKER
$emails = array();
$strEmail= 'FROM "' . $strFromEmail . '"';
$strEmail = "'" . $strEmail . " '";
echo '<BR> $strEmail: ' . $strEmail;
$arrayfrom = imap_search($inbox, $strEmail, SE_UID);
$strChkSubject = 'SUBJECT "' . 'INVOICE' . '"';
$strChkSubject = "'" . $strChkSubject . " '";
echo '<BR> $strChkSubject: ' . $strChkSubject;
$arrayInvoice = imap_search($inbox, $strChkSubject, SE_UID);
if((!empty($arrayfrom)) && (!empty($arrayInvoice)))
{
$emails = array_intersect($arrayfrom, $arrayInvoice);
}
And this is what I received - ( no errors in logs)SUCESSFUL CONNECTION TO EMAIL BOX: mytest@mytest.com
$strEmail: 'FROM "myemail@gmail.com" '
$strChkSubject: 'SUBJECT "INVOICE" '
NO INVOICE EMAILS TO PROCESS FOR REGION: 1001 EMAIL BOX: myemail@gmail.com
NO WORK ERROR FILES TO DELETE
NO WORK FILES TO DELETE
I also did a var_dump on each array and this is what it shows - Line 224 is where I execute the var_dump for arrayfrom.C:\wamp\www\Invoices\Invoices-ONLY-V7.php:224:boolean false
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
Also for login + all other imap calls, check errors + raise exceptions if they occur.
If you write code... always expecting every call to fail... adding error capture + raising exceptions... you'll have instant debugging clues, when things go wrong.