continue; } $log .= "-Logging in as " . $account['user'] . "...\n"; $imap->login($account['user'], $account['pass']); $log .= $imap->error; $response = $imap->open_mailbox("INBOX"); $log .= $imap->error; $emailList = $imap->search_mailbox("UNSEEN SINCE " . date("d-M-Y", time() - 24 * 60 * 60)); if (is_array($emailList)) { $log .= " Found " . sizeof($emailList) . " emails...\n"; foreach ($emailList as $emailId) { echo '.'; flush(); $category = $account['type']; $log .= " Checking Email #{$emailId}...\n"; $response = $imap->fetch_mail($emailId, "BODY[HEADER.FIELDS (SUBJECT FROM TO DATE)]"); //print $response."<BR>"; $response_ar = explode("\n", $response); $emailInfo = array(); foreach ($response_ar as $line) { $line = str_replace($remove_array, "", $line); if (substr($line, 0, strlen("From: ")) == "From: ") { $emailInfo['From'] = trim(quote_smart(substr($line, strlen("From: ")))); } if (substr($line, 0, strlen("Subject: ")) == "Subject: ") { $emailInfo['Subject'] = trim(quote_smart(substr($line, strlen("Subject: ")))); } if (substr($line, 0, strlen("To: ")) == "To: ") { $emailInfo['To'] = trim(quote_smart(substr($line, strlen("To: ")))); } if (substr($line, 0, strlen("Date: ")) == "Date: ") {