diff --git a/app/Console/Commands/ParseEml.php b/app/Console/Commands/ParseEml.php index ee272c666..9a13bbcf0 100644 --- a/app/Console/Commands/ParseEml.php +++ b/app/Console/Commands/ParseEml.php @@ -89,6 +89,8 @@ public function handle() $this->info($message->getInReplyTo()); $this->line('References: '); $this->info(json_encode(array_values(array_filter(preg_split('/[, <>]/', $message->getReferences() ?? ''))), JSON_UNESCAPED_UNICODE)); + $this->line('Date: '); + $this->info($message->getDate()); $this->line('Subject: '); $this->info($message->getSubject()); $this->line('Text Body: '); diff --git a/overrides/webklex/php-imap/src/Header.php b/overrides/webklex/php-imap/src/Header.php index 9a2cd3133..cdf7bb73f 100644 --- a/overrides/webklex/php-imap/src/Header.php +++ b/overrides/webklex/php-imap/src/Header.php @@ -857,7 +857,12 @@ private function parseDate($header) { $parsed_date = Carbon::parse($date); } catch (\Exception $_e) { if (!isset($this->config["fallback_date"])) { - throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e); + // Simply use current date. + // https://github.com/freescout-help-desk/freescout/issues/4159 + $parsed_date = Carbon::now(); + \Helper::logException(new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e)); + + //throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e); } else { $parsed_date = Carbon::parse($this->config["fallback_date"]); }