Skip to content

Commit

Permalink
Try to sanity check the date in the original headers too.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed May 31, 2016
1 parent 5052bbe commit 686e8e1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php
Expand Up @@ -1172,6 +1172,19 @@ protected function _buildMailMessage(
$headers = $imap_message->getHeaders();
$headers->removeHeader('Content-Type');
$headers->removeHeader('Content-Transfer-Encoding');

// Sanity check the date. Some clients die an unhappy
// death if the date is malformed. *cough* outlook *cough*
try {
$d = new Horde_Date($headers->getHeader('Date')->value_single);
if (!$d->year) {
$headers->removeHeader('Date');
$headers->addHeader('Date', date('r'));
}
} catch (Horde_Date_Exception $e) {
$headers->removeHeader('Date');
$headers->addHeader('Date', date('r'));
}
$airsync_body->data = $base->toString(array(
'headers' => $headers,
'stream' => true)
Expand Down

0 comments on commit 686e8e1

Please sign in to comment.