diff --git a/CHANGELOG.md b/CHANGELOG.md index 1110e3a6..046f82a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.5.10 - 2015-11-09 + * Fixing but in `MailAPI::markEmailAsRead()` and allowing you to set it as unread through the same function + ## 0.5.9 - 2015-11-05 * Adding ability to get the attachments of an eamil diff --git a/examples/mail/markMesssageAsRead.php b/examples/mail/markMesssageAsRead.php index ba1d40f4..e0395898 100644 --- a/examples/mail/markMesssageAsRead.php +++ b/examples/mail/markMesssageAsRead.php @@ -12,5 +12,9 @@ $read = $mailItem->isRead(); if (!$read) { + //Mark the mail as read $api->markMailAsRead($mailItem->getItemId()); +} else { + //Mark it as unread + $api->markMailAsRead($mailItem->getItemId(), false); } diff --git a/src/Mail/MailAPI.php b/src/Mail/MailAPI.php index c23b51e3..f3b9869c 100644 --- a/src/Mail/MailAPI.php +++ b/src/Mail/MailAPI.php @@ -119,15 +119,16 @@ public function updateMailItem($itemId, $changes) /** * @param $mailItem Type\MessageType|Type\ItemIdType + * @param $isRead boolean */ - public function markMailAsRead($mailItem) + public function markMailAsRead($mailItem, $isRead = true) { if ($mailItem instanceof Type\MessageType) { $mailItem = $mailItem->getItemId(); } $this->updateMailItem($mailItem, array( - 'IsRead' => false + 'IsRead' => $isRead )); }