Last Comment Bug 304999 - Emails not generating Date header for non-sendmail methods
: Emails not generating Date header for non-sendmail methods
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: Email Notifications (show other bugs)
: 2.19.3
: All All
: -- normal (vote)
: Bugzilla 3.0
Assigned To: Brion Vibber
: default-qa
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-17 11:35 PDT by Brock Haywood
Modified: 2007-05-24 15:23 PDT (History)
6 users (show)
mkanat: approval+
mkanat: approval3.0+
mkanat: blocking3.0.1+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch to Bugzilla/Mailer.pm in 3.0 (881 bytes, patch)
2007-05-16 20:16 PDT, Brion Vibber
glob: review+
Details | Diff | Review

Description Brock Haywood 2005-08-17 11:35:23 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

Ive noticed that my email client (Thunderbird) is displaying the date on
emails generated from my installation of bugzilla as 31/12/1969 4:00 PM.
Combing throught the mails i have received and comparing those to ones
that display correctly, the bugzilla mails seem to missing the "Date"
header. They contain the "Received" headers which contain the right date.

I am using qmail smtp for my mail server.

Reproducible: Always

Steps to Reproduce:
1. Do something in bugzilla to generate an email.
2. Open the email in your favorite text editor.
3. Look for the Date header.

Actual Results:  
Date header is missing.

Expected Results:  
The date header should be inserted by the MUA with something like:

Date: 12 Aug 2005 15:48:18 -0700

Perhaps Mail::Mailer should be doing this for bugzilla.
Comment 1 Max Kanat-Alexander 2005-08-17 11:38:25 PDT
We need to determine exactly which Mail::Mailer methods have this problem, and
which don't.

I ran into this problem when I used to do tech support for a mail server.

Basically, the email RFCs require that there be a Date header, but the SMTP RFC
doesn't require the MTA to add one. So *who* is supposed to add the Date header
is unclear.

Usually the "sendmail" interface adds the Date header automatically.

I would argue that it's Mail::Mailer's job to be adding this header.

I don't want to confirm the bug, though, until somebody else has actually
reproduced this.
Comment 2 Byron Jones ‹:glob› 2005-08-17 19:38:14 PDT
confirming.

i've encountered this before -- my sendmail wrapper will add the date header if
it's missing.

none of the Mailer::Mail methods insert the date, most smtp servers will, some
won't.

it shouldn't hurt things if we did it in BugMail..

off the top of my head..

    use Date::Format qw(time2str);
    ...
    my $headers = new Mail::Header \@header_lines, Modify => 0;
    if (!defined $headers->get('Date') {
        $headers->add('Date', time2str("%a, %e %b %Y %T %z", time()));
    }


Comment 3 Brock Haywood 2005-08-18 10:30:55 PDT
(In reply to comment #2)
> confirming.
> 
> i've encountered this before -- my sendmail wrapper will add the date header if
> it's missing.
> 
> none of the Mailer::Mail methods insert the date, most smtp servers will, some
> won't.
> 
> it shouldn't hurt things if we did it in BugMail..
> 
> off the top of my head..
> 
>     use Date::Format qw(time2str);
>     ...
>     my $headers = new Mail::Header \@header_lines, Modify => 0;
>     if (!defined $headers->get('Date') {
>         $headers->add('Date', time2str("%a, %e %b %Y %T %z", time()));
>     }
> 
> 
> 

I integrated this patch into my server (less the "use Date::Format line.. we
already use time2str in bugmail so i think its unecessary) and it works for me
correctly now. The date field is in my mail headers. 
Comment 4 Brion Vibber 2007-05-16 19:57:21 PDT
This bug appears to be alive and well in 3.0 with the SMTP method.
Comment 5 Brion Vibber 2007-05-16 20:16:53 PDT
Created attachment 265082 [details] [diff] [review]
Patch to Bugzilla/Mailer.pm in 3.0

Patch against Bugzilla 3.0 which adds the Date: header when using non-Sendmail method. Seems to work for our installation (http://bugzilla.wikimedia.org)
Comment 6 Brion Vibber 2007-05-16 20:19:15 PDT
Not sure if I'm a very bad person for trying to nominate this bug for 3.0.1, but I'm not sure how to get people's attention for patches to Bugzilla. ;)
Comment 7 Max Kanat-Alexander 2007-05-16 20:46:54 PDT
Sure, we can take this for 3.0.1. Could you just link me to an RFC somewhere that proves that that's the right date format? I'm also not sure what time2str will do with %z there, with just time() as the second argument. Does it just grab the timezone from the local machine?
Comment 8 Max Kanat-Alexander 2007-05-16 20:47:50 PDT
(In reply to comment #6)
> Not sure if I'm a very bad person for trying to nominate this bug for 3.0.1,
> but I'm not sure how to get people's attention for patches to Bugzilla. ;)

  By the way, what you need to do is read the Contributor's Guide, which will explain that you need to ask for review:

  http://www.bugzilla.org/docs/contributor.html
Comment 9 Byron Jones ‹:glob› 2007-05-16 21:36:18 PDT
> Could you just link me to an RFC somewhere that proves that that's the
> right date format?

RFC 822: 5.1, RFC 1123: 5.2.14

> Does it just grab the timezone from the local machine?

yes
Comment 10 Frédéric Buclin 2007-05-17 03:38:59 PDT
Comment on attachment 265082 [details] [diff] [review]
Patch to Bugzilla/Mailer.pm in 3.0

Byron seems the best reviewer for this patch.
Comment 11 Frédéric Buclin 2007-05-24 15:23:22 PDT
tip:

Checking in Bugzilla/Mailer.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm,v  <--  Mailer.pm
new revision: 1.8; previous revision: 1.7
done

3.0:

Checking in Bugzilla/Mailer.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm,v  <--  Mailer.pm
new revision: 1.7.2.1; previous revision: 1.7
done

Note You need to log in before you can comment on or make changes to this bug.