mirror of
https://github.com/retailcrm/Fetch.git
synced 2025-02-20 00:43:15 +03:00
Updated Message class to throw exception when passed nonexistant email ID
This commit is contained in:
parent
7af83a84db
commit
0bbc02b006
@ -175,7 +175,8 @@ class Message
|
|||||||
$this->imapConnection = $mailbox;
|
$this->imapConnection = $mailbox;
|
||||||
$this->uid = $messageUniqueId;
|
$this->uid = $messageUniqueId;
|
||||||
$this->imapStream = $this->imapConnection->getImapStream();
|
$this->imapStream = $this->imapConnection->getImapStream();
|
||||||
$this->loadMessage();
|
if($this->loadMessage() !== true)
|
||||||
|
throw new \RuntimeException('Message with ID ' . $messageUniqueId . ' not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,7 +189,8 @@ class Message
|
|||||||
|
|
||||||
/* First load the message overview information */
|
/* First load the message overview information */
|
||||||
|
|
||||||
$messageOverview = $this->getOverview();
|
if(!is_object($messageOverview = $this->getOverview()))
|
||||||
|
return false;
|
||||||
|
|
||||||
$this->subject = $messageOverview->subject;
|
$this->subject = $messageOverview->subject;
|
||||||
$this->date = strtotime($messageOverview->date);
|
$this->date = strtotime($messageOverview->date);
|
||||||
@ -225,6 +227,8 @@ class Message
|
|||||||
foreach ($structure->parts as $id => $part)
|
foreach ($structure->parts as $id => $part)
|
||||||
$this->processStructure($part, $id + 1);
|
$this->processStructure($part, $id + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user