Skip to content

Commit

Permalink
Fixing a bug in MailAPI::markMailAsRead
Browse files Browse the repository at this point in the history
  • Loading branch information
Garethp committed Nov 9, 2015
1 parent d9098aa commit 275f0ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions examples/mail/markMesssageAsRead.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 3 additions & 2 deletions src/Mail/MailAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
}

Expand Down

0 comments on commit 275f0ea

Please sign in to comment.