From: lpsolit%gmail.com <> Date: Fri, 25 May 2007 03:23:00 +0000 (+0000) Subject: Bug 304999: Emails not generating Date header for non-sendmail methods - Patch by... X-Git-Tag: bugzilla-3.0.1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24263849c5aa618d145966d40365b3326a85b99a;p=thirdparty%2Fbugzilla.git Bug 304999: Emails not generating Date header for non-sendmail methods - Patch by Brion Vibber r=glob a=mkanat --- diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index d5ecb5a384..e0f598b3df 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -41,6 +41,8 @@ use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Util; +use Date::Format qw(time2str); + use Encode qw(encode); use Email::MIME; # Loading this gives us encoding_set. @@ -89,6 +91,11 @@ sub MessageToMTA { $hostname = $1; $from .= "\@$hostname" if $from !~ /@/; $email->header_set('From', $from); + + # Sendmail adds a Date: header also, but others may not. + if (!defined $email->header('Date')) { + $email->header_set('Date', time2str("%a, %e %b %Y %T %z", time())); + } } if ($method eq "SMTP") {