Feng Forum

Support => Older versions => : vnju January 09, 2010, 04:37:34 AM

: 1.6.1 Email Problem - error Recieved Date
: vnju January 09, 2010, 04:37:34 AM
Since I  upgraded 1.6.1 from 1.6.0, I've got the error: The  'Recieved date' field of new Email equal 1970-01-01
Thanks
: Re: 1.6.1 Email Problem - error Recieved Date
: vnju January 13, 2010, 01:29:47 AM
no answer
: Re: 1.6.1 Email Problem - error Recieved Date
: ignacio January 19, 2010, 04:09:32 PM
Do you mean emails you compose or emails you receive?
: Re: 1.6.1 Email Problem - error Recieved Date
: vnju January 20, 2010, 12:09:31 AM
the new Emails I recieved.
I checked their 'recieved date'  field in database. All of them was 1970-01-01
: Re: 1.6.1 Email Problem - error Recieved Date
: ignacio January 20, 2010, 11:03:05 AM
I don't know if it's related, but what date format are you using?
: Re: 1.6.1 Email Problem - error Recieved Date
: vnju January 22, 2010, 04:57:40 AM
The date format I used as d/m/Y . It's default
The value "1970-01-01" was shown in database. In application, It was displayed as Today. As in MailController.php file, at line 1877, I saw this codes

"date" => $msg->getReceivedDate() instanceof DateTimeValue ? ($msg->getReceivedDate()->isToday() ? format_time($msg->getReceivedDate()) : format_datetime($msg->getReceivedDate())) : lang('n/a'),
Can u give me a solution?
thanks
: Re: 1.6.1 Email Problem - error Recieved Date
: ignacio January 22, 2010, 03:12:40 PM
So the background problem is that new email is being stored as received on '1970-01-01', right? Try changing file 'environment/classes/mail/MailUtilities.class.php' line 206 from:

:
if (array_key_exists("Date", $parsedMail)) {
$mail->setSentDate(new DateTimeValue(strtotime($parsedMail["Date"])));
}else{
$mail->setSentDate(new DateTimeValue(DateTimeValueLib::now()));
}
if (array_key_exists("Received", $parsedMail) && $parsedMail["Received"]) {
$mail->setReceivedDate(new DateTimeValue(strtotime($parsedMail["Received"])));
}else{
$mail->setReceivedDate(new DateTimeValue(DateTimeValueLib::now()));
}

to:

:
$sent_timestamp = false;
if (array_key_exists("Date", $parsedMail)) {
$sent_timestamp = strtotime($parsedMail["Date"]);
}
if ($sent_timestamp === false || $sent_timestamp === -1 || $sent_timestamp === 0) {
$mail->setSentDate(DateTimeValueLib::now());
} else {
$mail->setSentDate(new DateTimeValue($sent_timestamp));
}

$received_timestamp = false;
if (array_key_exists("Received", $parsedMail) && $parsedMail["Received"]) {
$received_timestamp = strtotime($parsedMail["Received"]);
}
if ($received_timestamp === false || $received_timestamp === -1 || $received_timestamp === 0) {
$mail->setReceivedDate($mail->getSentDate());
} else {
$mail->setReceivedDate(new DateTimeValue($received_timestamp));
}
: Re: 1.6.1 Email Problem - error Recieved Date
: vnju January 25, 2010, 01:16:51 AM
Thank ignacio for your reply
However,it was not successfull, it has still get that error.
 :(
thanks