From 50944535509d0ab631eec3c305f5d9362d4d8e06 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Oct 2024 13:48:54 -0400 Subject: [PATCH] Define processed and unprocessed email count for logging --- cron_ticket_email_parser.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index f565de1e..c4664ced 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -372,6 +372,10 @@ createMailboxFolder($imap, $mailbox, 'ITFlow'); // Search for unseen messages and get UIDs $emails = imap_search($imap, 'UNSEEN', SE_UID); +// Set Processed and Unprocessed Email count to 0 +$processed_count = 0; +$unprocessed_count = 0; + if ($emails !== false) { foreach ($emails as $email_uid) { $email_processed = false; @@ -483,11 +487,15 @@ if ($emails !== false) { imap_setflag_full($imap, $email_uid, "\\Seen", ST_UID); // Move the message to the 'ITFlow' folder imap_mail_move($imap, $email_uid, 'ITFlow', CP_UID); + // Get a Processed Email Count + $processed_count++; } else { // Flag the message for manual review without marking it as read imap_setflag_full($imap, $email_uid, "\\Flagged", ST_UID); // Clear the Seen flag to ensure the email remains unread imap_clearflag_full($imap, $email_uid, "\\Seen", ST_UID); + // Get an Unprocessed email count + $unprocessed_count++; } // Delete the temporary message file