summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorbugzilla%glob.com.au <>2005-12-23 10:36:19 +0100
committerbugzilla%glob.com.au <>2005-12-23 10:36:19 +0100
commit6ad87317b54ce81e3296c1e1a8c497dd31e9d3d7 (patch)
tree0fc05d79fc293d7d390956b35261d42f3f5be4f5 /Bugzilla
parentc8242c1e91984645c86b38f0794675406aecc4f6 (diff)
downloadbugzilla-6ad87317b54ce81e3296c1e1a8c497dd31e9d3d7.tar.gz
bugzilla-6ad87317b54ce81e3296c1e1a8c497dd31e9d3d7.tar.xz
Bug 94293: Sendmail "from" header can not be configured in one config file, From header broken in SMTP
Patch by Jochen Wiedmann <jochen.wiedmann@gmail.com> r=glob,a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/BugMail.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 69fb7b7b7..31d151112 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -639,8 +639,16 @@ sub MessageToMTA {
$headers = new Mail::Header \@header_lines, Modify => 0;
}
+ my $from = $headers->get('from');
+
if (Param("mail_delivery_method") eq "sendmail" && $^O =~ /MSWin32/i) {
- open(SENDMAIL, '|' . SENDMAIL_EXE . ' -t -i') ||
+ my $cmd = '|' . SENDMAIL_EXE . ' -t -i';
+ if ($from) {
+ # We're on Windows, thus no danger of command injection
+ # via $from. In other words, it is safe to embed $from.
+ $cmd .= qq# -f"$from"#;
+ }
+ open(SENDMAIL, $cmd) ||
die "Failed to execute " . SENDMAIL_EXE . ": $!\n";
print SENDMAIL $headers->as_string;
print SENDMAIL "\n";
@@ -652,12 +660,18 @@ sub MessageToMTA {
my @args;
if (Param("mail_delivery_method") eq "sendmail") {
push @args, "-i";
+ if ($from) {
+ push(@args, "-f$from");
+ }
}
if (Param("mail_delivery_method") eq "sendmail" && !Param("sendmailnow")) {
push @args, "-ODeliveryMode=deferred";
}
if (Param("mail_delivery_method") eq "smtp") {
push @args, Server => Param("smtpserver");
+ if ($from) {
+ $ENV{'MAILADDRESS'} = $from;
+ }
}
my $mailer = new Mail::Mailer Param("mail_delivery_method"), @args;
if (Param("mail_delivery_method") eq "testfile") {