RainLoop / rainloop-webmail

Simple, modern & fast web-based email client
http://rainloop.net
MIT License
4.1k stars 890 forks source link

"Date" header timezone #1360

Open yusuke-nakasaki opened 7 years ago

yusuke-nakasaki commented 7 years ago

RainLoop version, browser, OS: version: 1.9.4.402, OS: CentOS release 6.7

When I send a mail by RainLoop, "Date" header of mail is described in GMT(UTC).

I want "Date" header to be described in localtime timezone. (For example, JST).

How can I change "Date" header timezone?

Actual Date header Date: Thu, 09 Mar 2017 13:31:31 +0000 Expected Date header Date: Thu, 09 Mar 2017 22:31:31 +0900

For your reference, I'm setting the timezone to JST (GMT+9) on CentOS.

$ date
Thu Mar  9 22:31:31 JST 2017

Sorry for poor English.

ervee commented 7 years ago

Hi. Is this actually a problem?

The receiver MUA will take the UTC time and display the correct receiver date/time for the email. If RainLoop sends email with the local time, that would not make any difference at all. The receiver MUA will display the same local "sent" time.

I just tested with by business Outlook and this also sends email with a +0000 DATE header.

yusuke-nakasaki commented 7 years ago

ervee,

Thank you for your reply!

This is NOT actually problem. I understood your comments. Receiver MUA displays local time correctly.

But I would like to change Date header timezone from UTC to local time.

RFC5322 (Internet Message Format) states "The date and time-of-day SHOULD express local time." in section 3.3. https://datatracker.ietf.org/doc/html/rfc5322#section-3.3

So I examined the source code and changed it as follows.

rainloop/v/1.9.4.402/app/libraries/MailSo/Mime/Message.php

# diff -u Message.php.org Message.php
--- Message.php.org     2016-03-04 20:05:16.000000000 +0900
+++ Message.php 2017-03-24 23:32:22.686632970 +0900
@@ -862,7 +862,8 @@
        {
                if (!isset($this->aHeadersValue[\MailSo\Mime\Enumerations\Header::DATE]))
                {
-                       $oIncPart->Headers->SetByName(\MailSo\Mime\Enumerations\Header::DATE, \gmdate('r'), true);
+                       date_default_timezone_set('Asia/Tokyo');
+                       $oIncPart->Headers->SetByName(\MailSo\Mime\Enumerations\Header::DATE, \date('r'), true);
                }

                if (!isset($this->aHeadersValue[\MailSo\Mime\Enumerations\Header::MESSAGE_ID]))

Regards,

ervee commented 7 years ago

Hi Yusuke,

If the RFC says SHOULD, then it is not required (like with MUST). So a UTC date header is not wrong. But if you prefer so then go ahead. I won't consider this a bug though. I prefer UTC myself.