Skip to content

Commit

Permalink
Fixed Email Header DateTime Specification to be compliant with RFC 28…
Browse files Browse the repository at this point in the history
…22/5322
  • Loading branch information
mikeho committed Jul 18, 2011
1 parent c390e3d commit b1db4a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions includes/qcodo/_core/framework/QDateTime.class.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions includes/qcodo/_core/framework/QEmailServer.class.php
Expand Up @@ -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;
Expand Down

0 comments on commit b1db4a7

Please sign in to comment.