$lastEmailDate = CUserMail::getLastMailDate($_source->_id); $firstCheck = $lastEmailDate; $firstCheck = CMbDT::dateTime("-1 DAY", $firstCheck); $month_number = CMbDT::format($firstCheck, "%m"); $month = reset(array_keys(CFTP::$month_to_number, $month_number)); $dateIMAP = CMbDT::format($firstCheck, "%d-{$month}-%Y"); } //pop open account $pop = new CPop($_source); if (!$pop->open()) { CAppUI::stepAjax("Impossible de se connecter à la source (open) %s", UI_MSG_WARNING, $_source->_view); continue; } //If import mode (get before actual) if ($import) { $unseen = $pop->search('BEFORE "' . $dateIMAP . '"', true); } else { $unseen = $pop->search('SINCE "' . $dateIMAP . '"', true); } $results = count($unseen); $total = imap_num_msg($pop->_mailbox); //if get last email => check if uid server is > maxuidMb // @TODO : temporarly removed, we already get the more recent mail for filter /*if (!$import) { foreach ($unseen as $key => $_unseen) { if ($_unseen < $mbMailUid) { unset($unseen[$key]); } } }*/ array_splice($unseen, $limitMail);