Recent Topics

1 Jul 09, 2016 06:45    

I meet a problem that when the site sent a notification email, or connect an user with the email, we would get an email successfully but wrong date. They all set at the time '0001-01-01 08:00:00'. I use our own smtp server , and the time showing OK on the back office. More details of screenshots showing at second floor.

2 Jul 09, 2016 06:48

Detail showing as follows:

3 Jul 09, 2016 06:55

I have found the email sending code place , it seems that the header date is incorrect, and change little code would be OK.
inc\tools\model\_email.funcs.php, in function evo_mail_smtp, change from

$Swift_Message->setDate( $headers['Date'] );

to
global $servertimenow;
$Swift_Message->setDate( $servertimenow );

That's all.

I know it's just a temporary solution, still need our programmer to deal with it.

Best regards.

4 Jul 09, 2016 14:19

@haharen thanks for reporting both, issue and solution ;)

That's right, $Swift_Message->;setDate() expects for a UNIX timestamp, instead of a string.

Your solution works and is perfectly correct, but IMHO, I think that evo_mail_smtp is not the place to add b2evolution specific variables as $servertimenow, due to this function is a kind of abstraction layer to access smtp services, so it should respect whatever it's receiving on its $headers parameter.

Maybe we should just try to parse down the value received on $headers['Date'] to an integer value, and let Swift to process it.

Something like this, I guess:

$headers['Date'] = ( is_string($headers['Date']) ) ? strtotime($headers['Date']) : $headers['Date'];
$Swift_Message->setDate( $headers['Date'] );

Regards!

5 Jul 09, 2016 15:56

@mgsolipa
Yes, it's really the best way. I have changed the code and it ran correctly.
Thanks a lot!

6 Aug 07, 2016 21:38

This will be included in b2evolution 6.7.5.


Form is loading...