Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/backend/imap/imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,9 @@ public function GetMessage($folderid, $id, $contentparameters) {
unset($textBody);
unset($mail_headers);

$output->datereceived = isset($message->headers["date"]) ? $this->cleanupDate($message->headers["date"]) : null;
$output->datereceived = null;
if (isset($message->headers["date"]))
$output->datereceived = is_array($message->headers["date"]) ? $message->headers["date"][0] : $message->headers["date"];

if ($is_smime) {
// #190, KD 2015-06-04 - Add Encrypted (and possibly signed) to the classifications emitted
Expand All @@ -1332,10 +1334,15 @@ public function GetMessage($folderid, $id, $contentparameters) {
else {
$output->messageclass = "IPM.Note";
}
$output->subject = isset($message->headers["subject"]) ? $message->headers["subject"] : "";
$output->subject = null;
if (isset($message->headers["subject"]))
$output->subject = is_array($message->headers["subject"]) ? $message->headers["subject"][0] : $message->headers["subject"];

$output->read = $stat["flags"];
$output->from = isset($message->headers["from"]) ? $message->headers["from"] : null;

$output->from = null;
if (isset($message->headers["from"]))
$output->from = is_array($message->headers["from"]) ? $message->headers["from"][0] : $message->headers["from"];
if (isset($message->headers["thread-topic"])) {
$output->threadtopic = $message->headers["thread-topic"];
}
Expand Down
11 changes: 8 additions & 3 deletions src/include/mimeDecode.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,14 @@ function _decode($headers, $body, $default_ctype = 'text/plain')
case 'multipart/relative': //#20431 - android
case 'multipart/mixed':
case 'application/vnd.wap.multipart.related':
if(!isset($content_type['other']['boundary'])){
$this->_error = 'No boundary found for ' . $content_type['value'] . ' part';
return false;
if (!isset($content_type['other']['boundary'])) {
if ($this->_include_bodies) {
$encoding = isset($content_transfer_encoding['value']) ? $content_transfer_encoding['value'] : '7bit';
$charset = isset($content_type['other']['charset']) ? $content_type['other']['charset'] : $this->_charset;
$return->body = $this->_decode_bodies ? $this->_decodeBody($body, $encoding, $charset, false) : $body;
}
$this->_error = 'Boundary missing in part ' . $content_type['value'] . ', content treated as plain text.';
break;
}

$default_ctype = (strtolower($content_type['value']) === 'multipart/digest') ? 'message/rfc822' : 'text/plain';
Expand Down
1 change: 1 addition & 0 deletions src/include/z_RFC822.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public function parseAddressList($address = null, $default_domain = null, $nest_

if (isset($address)) $this->address = $address;
// z-push addition
if (is_array($this->address)) $this->address = $this->address[0];
if (strlen(trim((string) $this->address)) == 0) return array();
if (isset($default_domain)) $this->default_domain = $default_domain;
if (isset($nest_groups)) $this->nestGroups = $nest_groups;
Expand Down
9 changes: 7 additions & 2 deletions src/lib/utils/timezoneutil.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,12 @@ public static function MakeUTCDate($value, $timezone = null) {
//If there is no timezone set, we use the default timezone
$tz = timezone_open(date_default_timezone_get());
}
//20110930T090000Z
$date = date_create_from_format('Ymd\THis\Z', $value, timezone_open("UTC"));
//2025-03-27T130000
$date = date_create_from_format('Y-m-d\THis', $value, $tz);
if (!$date) {
//20110930T090000Z
$date = date_create_from_format('Ymd\THis\Z', $value, timezone_open("UTC"));
}
if (!$date) {
//20110930T090000
$date = date_create_from_format('Ymd\THis', $value, $tz);
Expand All @@ -1331,6 +1335,7 @@ public static function MakeUTCDate($value, $timezone = null) {
}
if (!$date) {
ZLog::Write(LOGLEVEL_ERROR, sprintf("TimezoneUtil::MakeUTCDate(): failed to convert '%s' to date", $value));
return false;
}
return date_timestamp_get($date);
}
Expand Down