From 4d5504d623fa875816c9c10826229dcf7ccd2b26 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 25 May 2007 03:21:37 +0000 Subject: Bug 304999: Emails not generating Date header for non-sendmail methods - Patch by Brion Vibber r=glob a=mkanat --- Bugzilla/Mailer.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Bugzilla/Mailer.pm') diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index d5ecb5a38..e0f598b3d 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") { -- cgit v1.2.3-24-g4f1b