summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-08-30 10:35:18 +0200
committerByron Jones <bjones@mozilla.com>2012-08-30 10:35:18 +0200
commit492a7b7ed5881b827a48857cec2f315d155fddc8 (patch)
treea82c457265f0c1cd0bf8da445924b36740e20b25
parent7bb45bbc6d445df6112e038bfa3853440249b217 (diff)
downloadbugzilla-492a7b7ed5881b827a48857cec2f315d155fddc8.tar.gz
bugzilla-492a7b7ed5881b827a48857cec2f315d155fddc8.tar.xz
Add x-generated-by header to bugmail
-rw-r--r--Bugzilla/BugMail.pm5
-rw-r--r--Bugzilla/Mailer.pm7
2 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 521291380..696db5ceb 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -48,6 +48,7 @@ use Date::Parse;
use Date::Format;
use Scalar::Util qw(blessed);
use List::MoreUtils qw(uniq firstidx);
+use Sys::Hostname;
use constant BIT_DIRECT => 1;
use constant BIT_WATCHING => 2;
@@ -465,6 +466,10 @@ sub _generate_bugmail {
# TT trims the trailing newline, and threadingmarker may be ignored.
my $email = new Email::MIME("$msg_header\n");
+
+ # For tracking/diagnostic purposes, add our hostname
+ $email->header_set('X-Generated-By' => hostname());
+
if (scalar(@parts) == 1) {
$email->content_type_set($parts[0]->content_type);
} else {
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index 74c9010c2..d27f79155 100644
--- a/Bugzilla/Mailer.pm
+++ b/Bugzilla/Mailer.pm
@@ -49,6 +49,7 @@ use Encode::MIME::Header;
use Email::Address;
use Email::MIME;
use Email::Send;
+use Sys::Hostname;
sub MessageToMTA {
my ($msg, $send_now) = (@_);
@@ -142,6 +143,12 @@ sub MessageToMTA {
}
}
+ # For tracking/diagnostic purposes, add our hostname
+ my $generated_by = $email->header('X-Generated-By') || '';
+ if ($generated_by =~ tr/\/// < 3) {
+ $email->header_set('X-Generated-By' => $generated_by . '/' . hostname() . "($$)");
+ }
+
if ($method eq "SMTP") {
push @args, Host => Bugzilla->params->{"smtpserver"},
username => Bugzilla->params->{"smtp_username"},