Bug 304999: Emails not generating Date header for non-sendmail methods - Patch by Brion Vibber <brion@pobox.com> r=glob a=mkanat

git-svn-id: svn://10.0.0.236/trunk@226977 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
lpsolit%gmail.com
2007-05-24 22:23:00 +00:00
parent c1ae9d7b7c
commit d41a0aef7d

View 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") {