From 37ea0077ad90517e2096a63a8f6d1c8027f0f631 Mon Sep 17 00:00:00 2001 From: crazy-max Date: Sun, 8 Nov 2015 19:22:41 +0100 Subject: [PATCH] Update example.php --- class.cws.mbh.php | 2 +- example.php | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/class.cws.mbh.php b/class.cws.mbh.php index 39c52d3..27e71bb 100644 --- a/class.cws.mbh.php +++ b/class.cws.mbh.php @@ -332,7 +332,7 @@ public function openEmlFolder($emlFolder) } $nbFiles = 0; - while ($file = readdir($handle)) { + while (false !== ($file = readdir($handle))) { if ($file == '.' || $file == '..' || !self::endWith($file, '.eml')) { continue; } diff --git a/example.php b/example.php index 310a588..1c2a42d 100644 --- a/example.php +++ b/example.php @@ -22,7 +22,7 @@ /** * Eml folder */ -if ($cwsMbh->openEmlFolder('test') === false) { +if ($cwsMbh->openEmlFolder('emls') === false) { $error = $cwsMbh->getError(); return; } @@ -57,4 +57,31 @@ $error = $cwsMbh->getError(); } else { // continue with CwsMbhResult + + $counter = $result->getCounter(); + echo '

Counter

'; + echo 'total : ' . $counter->getTotal() . '
'; + echo 'fetched : ' . $counter->getFetched() . '
'; + echo 'processed : ' . $counter->getProcessed() . '
'; + echo 'unprocessed : ' . $counter->getUnprocessed() . '
'; + echo 'deleted : ' . $counter->getDeleted() . '
'; + echo 'moved : ' . $counter->getMoved() . '
'; + + $mails = $result->getMails(); + echo '

Mails

'; + foreach ($mails as $mail) { + if (!$mail instanceof CwsMbhMail) { + continue; + } + echo '

' . $mail->getToken() . '

'; + echo 'subject : ' . $mail->getSubject() . '
'; + echo 'type : ' . $mail->getType() . '
'; + echo 'recipients :
'; + foreach ($mail->getRecipients() as $recipient) { + if (!$recipient instanceof CwsMbhRecipient) { + continue; + } + echo '- ' . $recipient->getEmail() . '
'; + } + } }