Skip to content

Commit

Permalink
Issue #318: Fixed issue with empty date field, when date field exists
Browse files Browse the repository at this point in the history
Issue #318: Fixed issue with empty date field, when date field exists
  • Loading branch information
Sebbo94BY authored May 12, 2019
2 parents ab18be7 + 89be6bf commit c0750ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/PhpImap/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,10 @@ public function getMailHeader($mailId) {
$header->precedence = (preg_match("/Precedence\:(.*)/i", $headersRaw, $matches)) ? trim($matches[1]) : "";
$header->failedRecipients = (preg_match("/Failed-Recipients\:(.*)/i", $headersRaw, $matches)) ? trim($matches[1]) : "";

if(isset($head->date)) {
if(isset($head->date) AND !empty($head->date)) {
$header->date = self::parseDateTime($head->date);
} elseif(isset($head->Date) AND !empty($head->Date)) {
$header->date = self::parseDateTime($head->Date);
} else {
$now = new DateTime;
$header->date = self::parseDateTime($now->format('Y-m-d H:i:s'));
Expand Down

0 comments on commit c0750ec

Please sign in to comment.