summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-05-25 05:21:37 +0200
committerlpsolit%gmail.com <>2007-05-25 05:21:37 +0200
commit4d5504d623fa875816c9c10826229dcf7ccd2b26 (patch)
treeb8607b501bb8a35e2c1dd18531e122c015a5ad00
parentcdab862a317f175e1a5be79051c1063db7863596 (diff)
downloadbugzilla-4d5504d623fa875816c9c10826229dcf7ccd2b26.tar.gz
bugzilla-4d5504d623fa875816c9c10826229dcf7ccd2b26.tar.xz
Bug 304999: Emails not generating Date header for non-sendmail methods - Patch by Brion Vibber <brion@pobox.com> r=glob a=mkanat
-rw-r--r--Bugzilla/Mailer.pm7
1 files changed, 7 insertions, 0 deletions
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") {