Hello!
For now i've fixed this from sysadmins' side - i.e. rewriting email
"Date" header on local Postfix. Short recipe:
1) add headers check in main.cf like
header_checks = pcre:/etc/postfix/header_checks
2) add filtering rule
root@otrs:~# cat /etc/postfix/header_checks
# header_checks for date removal
/^(Date: .* [+-][0-9]{4})$/ REPLACE X-$1

the rule above will replace "Date" header with "X-Date", effectively
removing the wrong one and providing the possibility to see what was in
the original header. Some magic happens later - when postfix's cleanup
procedure in processing email - it fixes obvious errors like missing
"Date" header and adding new one (with proper offset and such).

Idea has been taken from
http://www.irbs.net/internet/postfix/0704/0082.html , so kudos to Noel
Jones .
Hope this will help someone later.

Ovchinnikov Roman, Paymantix
Cell +7 (926) 262-40-05 | Email: r.ovchinni...@paymantix.com| Skype: 
rovchinnikov.mm

On 07.05.2015 19:00, Gerald Young wrote:
> This is only for reference. Perhaps it might help.
>
> Kernel/System/Email.pm sends mail.
> https://github.com/OTRS/otrs/blob/rel-4_0/Kernel/System/Email.pm#L308
>
> # add date header
> $Header{Date} = 'Date: '.
> $Kernel::OM->Get('Kernel::System::Time')->MailTimeStamp();    
>
> MailTimeStamp is defined here:
> https://github.com/OTRS/otrs/blob/rel-4_0/Kernel/System/Time.pm#L363
>
> offsite defined:
> # calculate offset - should be '+0200', '-0600', '+0000' or '+0530'
> my$Diff= Time::Local::timegm_nocheck( localtime( time() ) ) - time();
>
>       
>
> Time::Local
> http://search.cpan.org/~drolsky/Time-Local-1.2300/lib/Time/Local.pm
> <http://search.cpan.org/%7Edrolsky/Time-Local-1.2300/lib/Time/Local.pm>
>
> perl localtime
> http://perldoc.perl.org/functions/localtime.html
>
> I have to step away for a bit, but maybe someone else can step in.
>
> On Thu, May 7, 2015 at 10:44 AM, Roman Ovchinnikov
> <r.ovchinni...@paymantix.com <mailto:r.ovchinni...@paymantix.com>> wrote:
>
>     Thank you Gerald!
>     I've just checked several hours ago this idea about SMTP MTA is
>     doing weird things, so I captured traffic (tcpdump on localhost,
>     port 25) and I see that MTA is not problem here, see below cut of
>     the dump in text viewable format by tcpflow, highlighted Date with
>     red:
>
>     127.000.000.001.00025-127.000.000.001.36526: 220 otrs.paymantix.net 
> <http://otrs.paymantix.net> ESMTP Postfix
>
>     127.000.000.001.36526-127.000.000.001.00025: EHLO otrs.paymantix.net 
> <http://otrs.paymantix.net>
>
>     127.000.000.001.00025-127.000.000.001.36526: 250-otrs.paymantix.net 
> <http://250-otrs.paymantix.net>
>
>     250-PIPELINING
>
>     250-SIZE 10240000
>
>     250-VRFY
>
>     250-ETRN
>
>     250-STARTTLS
>
>     250-ENHANCEDSTATUSCODES
>
>     250-8BITMIME
>
>     250 DSN
>
>     127.000.000.001.36526-127.000.000.001.00025: MAIL FROM:<>
>
>     127.000.000.001.00025-127.000.000.001.36526: 250 2.1.0 Ok
>
>     127.000.000.001.36526-127.000.000.001.00025: RCPT 
> TO:<r.ovchinni...@paymantix.com> <mailto:r.ovchinni...@paymantix.com>
>
>     127.000.000.001.00025-127.000.000.001.36526: 250 2.1.5 Ok
>
>     127.000.000.001.36526-127.000.000.001.00025: DATA
>
>     127.000.000.001.00025-127.000.000.001.36526: 354 End data with 
> <CR><LF>.<CR><LF>
>
>     127.000.000.001.36526-127.000.000.001.00025: MIME-Version: 1.0
>
>     Subject: [Ticket#0101297] RE: test message, do not reply
>
>     X-Powered-BY: OTRS - Open Ticket Request System (http://otrs.org/)
>
>     X-Mailer: OTRS Mail Service (4.0.7)
>
>     *Date: Thu, 7 May 2015 14:15:03 +0000*
>
>     Precedence: bulk
>
>     X-Loop: yes
>
>     Auto-Submitted: auto-generated
>
>     Message-ID: <1431008103.834083.466920457.131...@otrs.paymantix.net> 
> <mailto:1431008103.834083.466920457.131...@otrs.paymantix.net>
>
>     To: Roman Ovchinnikov <r.ovchinni...@paymantix.com> 
> <mailto:r.ovchinni...@paymantix.com>
>
>     Organization: Paymantix
>
>     From: supp...@ecommpay.com <mailto:supp...@ecommpay.com> 
> <supp...@ecommpay.com> <mailto:supp...@ecommpay.com>
>
>     In-Reply-To: <554b48ae.2090...@paymantix.com> 
> <mailto:554b48ae.2090...@paymantix.com>
>
>     Content-Type: multipart/alternative; 
> boundary="----------=_1430997303-3991-2"
>
>
>     As you can see, message received by MTA is already with DATE
>     header, so, from my point of view the problem is on OTRS' side
>     somehow. I can even add the dump file itself if needed.
>
>     Ovchinnikov Roman, Paymantix
>     Cell +7 (926) 262-40-05 <tel:%2B7%20%28926%29%20262-40-05> | Email: 
> r.ovchinni...@paymantix.com <mailto:r.ovchinni...@paymantix.com>| Skype: 
> rovchinnikov.mm <http://rovchinnikov.mm>
>
>     On 07.05.2015 15:58, Gerald Young wrote:
>>     This is more about your MTA/SMTP server than it is about OTRS.
>>     OTRS doesn't really do anything more than use mailing APIs to
>>     adjust offset. 
>>
>>     But yes, offset on "Date" is wrong, but 9:30 UTC= 12:30 UTC+3.
>>
>>     https://www.google.com/search?q=smtp+header+utc+offset+date
>>
>>     On Thu, May 7, 2015 at 4:40 AM, Roman Ovchinnikov
>>     <r.ovchinni...@paymantix.com
>>     <mailto:r.ovchinni...@paymantix.com>> wrote:
>>
>>         Hello!
>>         Any ideas about this?
>>
>>         Ovchinnikov Roman, Paymantix
>>         Cell +7 (926) 262-40-05 <tel:%2B7%20%28926%29%20262-40-05> |
>>         Email: r.ovchinni...@paymantix.com
>>         <mailto:r.ovchinni...@paymantix.com>| Skype: rovchinnikov.mm
>>         <http://rovchinnikov.mm>
>>
>>         On 30.04.2015 13:13, Roman Ovchinnikov wrote:
>>         > Hello!
>>         > Recently we have installed otrs 4.0.7 and found that emails
>>         being sent
>>         > from system has wrong timezone settings in Date field, for
>>         example:
>>         >
>>         > Received: from mail.paymantix.com
>>         <http://mail.paymantix.com> (LHLO mail.paymantix.com
>>         <http://mail.paymantix.com>) (78.140.183.180)
>>         >  by mail.paymantix.com <http://mail.paymantix.com> with
>>         LMTP; Thu, 30 Apr 2015 09:30:28 +0000 (UTC)
>>         > Received: from mail.paymantix.com
>>         <http://mail.paymantix.com> (localhost [127.0.0.1])
>>         >       by mail.paymantix.com <http://mail.paymantix.com>
>>         (Postfix) with ESMTPS id 9962116113E
>>         >       for <r.ovchinni...@paymantix.com
>>         <mailto:r.ovchinni...@paymantix.com>>; Thu, 30 Apr 2015
>>         09:30:28 +0000 (UTC)
>>         > Received: from localhost (localhost [127.0.0.1])
>>         >       by mail.paymantix.com <http://mail.paymantix.com>
>>         (Postfix) with ESMTP id 8C8AA161198
>>         >       for <r.ovchinni...@paymantix.com
>>         <mailto:r.ovchinni...@paymantix.com>>; Thu, 30 Apr 2015
>>         09:30:28 +0000 (UTC)
>>         > X-Virus-Scanned: amavisd-new at paymantix.com
>>         <http://paymantix.com>
>>         > Received: from mail.paymantix.com
>>         <http://mail.paymantix.com> ([127.0.0.1])
>>         >       by localhost (mail.paymantix.com
>>         <http://mail.paymantix.com> [127.0.0.1]) (amavisd-new, port
>>         10026)
>>         >       with ESMTP id BT8gD6m4-Jxz for
>>         <r.ovchinni...@paymantix.com
>>         <mailto:r.ovchinni...@paymantix.com>>;
>>         >       Thu, 30 Apr 2015 09:30:28 +0000 (UTC)
>>         > Received: from otrs.paymantix.net
>>         <http://otrs.paymantix.net> (unknown [78.140.183.183])
>>         >       by mail.paymantix.com <http://mail.paymantix.com>
>>         (Postfix) with ESMTPS id 778EA16113E
>>         >       for <r.ovchinni...@paymantix.com
>>         <mailto:r.ovchinni...@paymantix.com>>; Thu, 30 Apr 2015
>>         09:30:28 +0000 (UTC)
>>         > Received: from otrs.paymantix.net
>>         <http://otrs.paymantix.net> (localhost [127.0.0.1])
>>         >       by otrs.paymantix.net <http://otrs.paymantix.net>
>>         (Postfix) with ESMTP id 5FF5F93
>>         >       for <r.ovchinni...@paymantix.com
>>         <mailto:r.ovchinni...@paymantix.com>>; Thu, 30 Apr 2015
>>         09:30:03 +0000 (UTC)
>>         > MIME-Version: 1.0
>>         > Subject: [Ticket#0100341] RE: test
>>         > X-Powered-BY: OTRS - Open Ticket Request System
>>         (http://otrs.org/)
>>         > X-Mailer: OTRS Mail Service (4.0.7)
>>         > Date: Thu, 30 Apr 2015 12:30:03 +0000
>>         >
>>         >
>>         > as you can see, date in mail server messages are ok
>>         > 09:30:28 +0000 (UTC)), while
>>         > Date: Thu, 30 Apr 2015 12:30:03 +0000
>>         >
>>         > so, offset is wrong. Server itself has UTC timezone, OTRS
>>         is configured as UTC +3 .
>>         >
>>         > Not sure what else should be tweaked, googling didn't give
>>         me any insights on this.
>>         >
>>
>>         ---------------------------------------------------------------------
>>         OTRS mailing list: otrs - Webpage: http://otrs.org/
>>         Archive: http://lists.otrs.org/pipermail/otrs
>>         To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
>>
>>
>>
>>
>>     ---------------------------------------------------------------------
>>     OTRS mailing list: otrs - Webpage: http://otrs.org/
>>     Archive: http://lists.otrs.org/pipermail/otrs
>>     To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
>
>
>     ---------------------------------------------------------------------
>     OTRS mailing list: otrs - Webpage: http://otrs.org/
>     Archive: http://lists.otrs.org/pipermail/otrs
>     To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
>
>
>
>
> ---------------------------------------------------------------------
> OTRS mailing list: otrs - Webpage: http://otrs.org/
> Archive: http://lists.otrs.org/pipermail/otrs
> To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Reply via email to