Missing 'Date: ' header

Hello, I have OTRS installed on a server that uses qmail as SMTP relay. OTRS does not include a "Date: " header when sending messages maybe because it expects the MTA to do it instead. Unfortunately qmail does not add the missing header and if the e-mail message passes only through qmail servers then it arrives at destination "date-less". This is very annoying so I tried to modify the following section from the SMTP.pm file: $Param{Header} .= "Subject: $Param{Subject}\n"; $Param{Header} .= "X-Mailer: OTRS Mail Service ($VERSION)\n"; by adding $Param{Header} .= "Date: " . strftime "%a, %d %b %Y %T %z", localtime ; Unfortunately this doesn't seem to solve the issue... Do you have another suggestion ? Thanx Mihai

On Mon, 2003-10-20 at 18:57, Mihai Maties wrote:
I have OTRS installed on a server that uses qmail as SMTP relay. OTRS does not include a "Date: " header when sending messages maybe because it expects the MTA to do it instead. Unfortunately qmail does not add the missing header and if the e-mail message passes only through qmail servers then it arrives at destination "date-less".
That's not what's supposed to happen, and it's not what, in my experience, does happen. The behaviour I see is that described in the qmail-header man page: STAMPS Every message must contain a Date field, with the date in a strict format defined by RFC 822. If necessary qmail-inject creates a new Date field with the current date (in GMT). I know this because I investigated it recently when a customer "complained" that the Date header of messages from OTRS was displayed differently by his mail program (because the date originated in GMT time, not local time).
This is very annoying so I tried to modify the following section from the SMTP.pm file:
$Param{Header} .= "Subject: $Param{Subject}\n"; $Param{Header} .= "X-Mailer: OTRS Mail Service ($VERSION)\n";
by adding
$Param{Header} .= "Date: " . strftime "%a, %d %b %Y %T %z", localtime ;
Unfortunately this doesn't seem to solve the issue...
Do you have another suggestion ?
Check qmail. It shouldn't be behaving as you say it does. If you pipe a simple message without a Date header, e.g. From, To and body will do, to 'qmail-inject -n', you should get a Date header in the output. When I do that, I get Return-path, Date and Message-ID headers added. Jim

On Tue, Oct 21, 2003 at 10:15:29AM +0100, Jim Wight wrote:
On Mon, 2003-10-20 at 18:57, Mihai Maties wrote:
I have OTRS installed on a server that uses qmail as SMTP relay. OTRS does not include a "Date: " header when sending messages maybe because it expects the MTA to do it instead. Unfortunately qmail does not add the missing header and if the e-mail message passes only through qmail servers then it arrives at destination "date-less".
That's not what's supposed to happen, and it's not what, in my experience, does happen. The behaviour I see is that described in the qmail-header man page:
that's also RFC behaviour. I noticed this several months ago and fixed it in cvs. What version are you using? -- Regards, Wiktor Wodecki

On Tuesday 21 October 2003 12:20, Wiktor Wodecki wrote:
On Tue, Oct 21, 2003 at 10:15:29AM +0100, Jim Wight wrote:
On Mon, 2003-10-20 at 18:57, Mihai Maties wrote:
I have OTRS installed on a server that uses qmail as SMTP relay. OTRS does not include a "Date: " header when sending messages maybe because it expects the MTA to do it instead. Unfortunately qmail does not add the missing header and if the e-mail message passes only through qmail servers then it arrives at destination "date-less".
That's not what's supposed to happen, and it's not what, in my experience, does happen. The behaviour I see is that described in the qmail-header man page:
that's also RFC behaviour. I noticed this several months ago and fixed it in cvs. What version are you using?
I'm using OTRS 1.1.1. So, this issue was fixed in CVS ? If yes, please tell me in what file did you changed/added the code because I looked into SMTP.pm and that header is not present. Mihai

On Tue, Oct 21, 2003 at 01:11:26PM +0300, Mihai Maties wrote:
On Tuesday 21 October 2003 12:20, Wiktor Wodecki wrote:
On Tue, Oct 21, 2003 at 10:15:29AM +0100, Jim Wight wrote:
On Mon, 2003-10-20 at 18:57, Mihai Maties wrote:
I have OTRS installed on a server that uses qmail as SMTP relay. OTRS does not include a "Date: " header when sending messages maybe because it expects the MTA to do it instead. Unfortunately qmail does not add the missing header and if the e-mail message passes only through qmail servers then it arrives at destination "date-less".
That's not what's supposed to happen, and it's not what, in my experience, does happen. The behaviour I see is that described in the qmail-header man page:
that's also RFC behaviour. I noticed this several months ago and fixed it in cvs. What version are you using?
I'm using OTRS 1.1.1. So, this issue was fixed in CVS ? If yes, please tell me in what file did you changed/added the code because I looked into SMTP.pm and that header is not present.
hmm, you're right, it's not in cvs try this: $Param{Header} .= "X-Powered-By: OTRS - Open Ticket Request System (http://otrs.org/)\n"; $Param{Header} .= "Message-ID: <".time().".".rand(999999)."\@$Self->{FQDN}>\n"; } $Param{Header} .= "Date: ".strftime("%a,%e %b %Y %H:%M:%S %z", localtime(time))."\n"; in Email/Sendmail.pm if you use something different, patch SMTP, should be similar -- Regards, Wiktor Wodecki

On Tuesday 21 October 2003 14:31, Wiktor Wodecki wrote:
hmm, you're right, it's not in cvs try this:
$Param{Header} .= "X-Powered-By: OTRS - Open Ticket Request System (http://otrs.org/)\n"; $Param{Header} .= "Message-ID: <".time().".".rand(999999)."\@$Self->{FQDN}>\n"; } $Param{Header} .= "Date: ".strftime("%a,%e %b %Y %H:%M:%S %z", localtime(time))."\n";
in Email/Sendmail.pm
if you use something different, patch SMTP, should be similar
Thank you, I did patch SMTP.pm and the Date header is now present. It seems that my problem was that I didn't add the line in the proper place. Anyway your line has a small bug: after "%a," before "%e" there should be a blank space. Mihai

On Tue, Oct 21, 2003 at 03:30:56PM +0300, Mihai Maties wrote:
On Tuesday 21 October 2003 14:31, Wiktor Wodecki wrote:
hmm, you're right, it's not in cvs try this:
$Param{Header} .= "X-Powered-By: OTRS - Open Ticket Request System (http://otrs.org/)\n"; $Param{Header} .= "Message-ID: <".time().".".rand(999999)."\@$Self->{FQDN}>\n"; } $Param{Header} .= "Date: ".strftime("%a,%e %b %Y %H:%M:%S %z", localtime(time))."\n";
in Email/Sendmail.pm
if you use something different, patch SMTP, should be similar
Thank you, I did patch SMTP.pm and the Date header is now present.
It seems that my problem was that I didn't add the line in the proper place. Anyway your line has a small bug: after "%a," before "%e" there should be a blank space.
ah, yes, you are right -- Regards, Wiktor Wodecki

On Tuesday 21 October 2003 12:15, Jim Wight wrote:
That's not what's supposed to happen, and it's not what, in my experience, does happen. The behaviour I see is that described in the qmail-header man page:
STAMPS Every message must contain a Date field, with the date in a strict format defined by RFC 822. If necessary qmail-inject creates a new Date field with the current date (in GMT).
I know this because I investigated it recently when a customer "complained" that the Date header of messages from OTRS was displayed differently by his mail program (because the date originated in GMT time, not local time).
Yes I know about this GMT issue with qmail, but my situation has nothing to do with it. It is the MUA's duty to create an email with rfc822 compliant headers and qmail-inject just helps if you are creating messages locally behaving just as sendmail. In this situation OTRS is the MUA and it is his fault that it does not add the Date header.
This is very annoying so I tried to modify the following section from the SMTP.pm file:
$Param{Header} .= "Subject: $Param{Subject}\n"; $Param{Header} .= "X-Mailer: OTRS Mail Service ($VERSION)\n";
by adding
$Param{Header} .= "Date: " . strftime "%a, %d %b %Y %T %z", localtime ;
Unfortunately this doesn't seem to solve the issue...
Do you have another suggestion ?
Check qmail. It shouldn't be behaving as you say it does. If you pipe a simple message without a Date header, e.g. From, To and body will do, to 'qmail-inject -n', you should get a Date header in the output. When I do that, I get Return-path, Date and Message-ID headers added.
Yes, you're right, qmail-inject creates the missing header but qmail expects that the messages received via SMTP to already have all the headers. I don't have OTRS and qmail on the same machine so I cannot use qmail-inject directly. This is my session with the mail server: <--- cut here ---> telnet mail.domain.ro 25 Trying 10.11.0.3... Connected to mail.domain.ro. Escape character is '^]'. 220 mail.domain.ro ESMTP helo a 250 mail.domain.ro mail from: mmaties@domain.ro 250 ok rcpt to: mmaties@domain.ro 250 ok data 354 go ahead boo . 250 ok 1066726188 qp 20625 quit 221 mail.domain.ro Connection closed by foreign host. --- cut here ---> and this is the final message in my inbox: <--- cut here ---> Received: (qmail 20631 invoked from network); 21 Oct 2003 08:49:48 -0000 Received: from mmaties.domain.ro (HELO a) (10.10.16.18) by mail.domain.ro with SMTP; 21 Oct 2003 08:49:44 -0000 Status: R X-Status: N X-KMail-EncryptionState: X-KMail-SignatureState: boo --- cut here ---> So, after all, I believe that OTRS should add the "Date: " field not expect the MTA to do it instead. I know that OTRS works correctly with other MTAs but it does not conform to RFC when doing this... If you still do not agree with me to fix this at least suggest me a workaround besides adding the header from qmail. Why adding the line $Param{Header} .= "Date: " . strftime "%a, %d %b %Y %T %z", localtime ; does not work ? ( I admit that I don't have too much perl experience ) Mihai
participants (3)
-
Jim Wight
-
Mihai Maties
-
Wiktor Wodecki