]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 304999: Emails not generating Date header for non-sendmail methods - Patch by...
authorlpsolit%gmail.com <>
Fri, 25 May 2007 03:23:00 +0000 (03:23 +0000)
committerlpsolit%gmail.com <>
Fri, 25 May 2007 03:23:00 +0000 (03:23 +0000)
Bugzilla/Mailer.pm

index d5ecb5a384d82e33783cb41e246b8feb05b6f1d0..e0f598b3dfbf047a633658e81c811b26e1791bd2 100644 (file)
@@ -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") {