From b1db4a715252b186279bb6fb080e13d600a586db Mon Sep 17 00:00:00 2001 From: Mike Ho Date: Mon, 18 Jul 2011 07:21:15 -0700 Subject: [PATCH] Fixed Email Header DateTime Specification to be compliant with RFC 2822/5322 --- includes/qcodo/_core/framework/QDateTime.class.php | 8 ++++++++ includes/qcodo/_core/framework/QEmailServer.class.php | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/qcodo/_core/framework/QDateTime.class.php b/includes/qcodo/_core/framework/QDateTime.class.php index a2b3ae43..c385b486 100644 --- a/includes/qcodo/_core/framework/QDateTime.class.php +++ b/includes/qcodo/_core/framework/QDateTime.class.php @@ -24,6 +24,11 @@ class QDateTime extends DateTime { const FormatDisplayTime = 'hh:mm:ss zz'; const FormatRfc822 = 'DDD, DD MMM YYYY hhhh:mm:ss ttt'; + // Note: RFC 5322 actually obsoletes RFC 2822, but both have the same date time format specification + // Both constants are defined here just as a convenience + const FormatRfc2822 = 'DDD, DD MMM YYYY hhhh:mm:ss ttttt'; + const FormatRfc5322 = 'DDD, DD MMM YYYY hhhh:mm:ss ttttt'; + const FormatSoap = 'YYYY-MM-DDThhhh:mm:ss'; public static $DefaultFormat = QDateTime::FormatDisplayDateTime; @@ -356,6 +361,9 @@ public function ToString($strFormat = null) { case 'tttt': $strToReturn .= parent::format('e'); break; + case 'ttttt': + $strToReturn .= parent::format('O'); + break; default: $strToReturn .= $strArray[$intIndex]; diff --git a/includes/qcodo/_core/framework/QEmailServer.class.php b/includes/qcodo/_core/framework/QEmailServer.class.php index 531bb34e..594ce44f 100644 --- a/includes/qcodo/_core/framework/QEmailServer.class.php +++ b/includes/qcodo/_core/framework/QEmailServer.class.php @@ -568,9 +568,9 @@ public function CalculateMessageHeaderAndBody($strEncodingType = null, QDateTime $this->SetHeader('To', $this->To); if ($dttSendDate) - $this->SetHeader('Date', $dttSendDate->ToString(QDateTime::FormatRfc822)); + $this->SetHeader('Date', $dttSendDate->ToString(QDateTime::FormatRfc5322)); else - $this->SetHeader('Date', QDateTime::NowToString(QDateTime::FormatRfc822)); + $this->SetHeader('Date', QDateTime::NowToString(QDateTime::FormatRfc5322)); // Setup Encoding Type (default to QApplication's if not specified) if (!$strEncodingType) $strEncodingType = QApplication::$EncodingType;