imap_timeout(IMAP_CLOSETIMEOUT, 120);
$searchCriteria = '';
- $searchCriteria = ($useSince ? 'SINCE ' : 'ON ');
+
if (!$date) {
- $date = date('d-M-Y');
- $searchCriteria .= '"' . $date . '" ';
+ //$date = date('d-M-Y');
+ $sinceDate = date('d-M-Y',strtotime("-1 day"));
+ $beforeDate = date('d-M-Y',strtotime("+1 day"));
+ $searchCriteria = 'SINCE "' . $sinceDate . '" BEFORE "' . $beforeDate . '"';
} else {
- $date = date('d-M-Y', strtotime($date));
- $searchCriteria .= '"' . $date . '" ';
+ $sinceDate = date('d-M-Y',strtotime("{$date} -1 day"));
+ $beforeDate = date('d-M-Y',strtotime("{$date} +1 day"));
+ if ($useSince) {
+ $searchCriteria = 'SINCE ';
+ $searchCriteria .= '"' . $date . '" ';
+ } else {
+ $searchCriteria = 'SINCE "' . $sinceDate . '" BEFORE "' . $beforeDate . '"';
+ }
+
}
if ($seen) {