Skip to content

Commit ac1596a

Browse files
lumigchgitster
authored andcommitted
send-email: add --[no-]xmailer option
Add --[no-]xmailer that allows a user to disable adding the 'X-Mailer:' header to the email being sent. Signed-off-by: Luis Henriques <henrix@camandro.org> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7fa1365 commit ac1596a

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

Documentation/config.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,6 +2260,7 @@ sendemail.smtpserveroption::
22602260
sendemail.smtpuser::
22612261
sendemail.thread::
22622262
sendemail.validate::
2263+
sendemail.xmailer::
22632264
See linkgit:git-send-email[1] for description.
22642265

22652266
sendemail.signedoffcc::

Documentation/git-send-email.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ Note that no attempts whatsoever are made to validate the encoding.
131131
Specify encoding of compose message. Default is the value of the
132132
'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
133133

134+
--xmailer::
135+
--no-xmailer::
136+
Add (or prevent adding) the "X-Mailer:" header. By default,
137+
the header is added, but it can be turned off by setting the
138+
`sendemail.xmailer` configuration variable to `false`.
134139

135140
Sending
136141
~~~~~~~

git-send-email.perl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ sub usage {
5454
--[no-]bcc <str> * Email Bcc:
5555
--subject <str> * Email "Subject:"
5656
--in-reply-to <str> * Email "In-Reply-To:"
57+
--[no-]xmailer * Add "X-Mailer:" header (default).
5758
--[no-]annotate * Review each patch that will be sent in an editor.
5859
--compose * Open an editor for introduction.
5960
--compose-encoding <str> * Encoding to assume for introduction.
@@ -148,7 +149,7 @@ sub format_2822_time {
148149
# Variables we fill in automatically, or via prompting:
149150
my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
150151
$initial_reply_to,$initial_subject,@files,
151-
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
152+
$author,$sender,$smtp_authpass,$annotate,$use_xmailer,$compose,$time);
152153

153154
my $envelope_sender;
154155

@@ -219,7 +220,8 @@ sub do_edit {
219220
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
220221
"validate" => [\$validate, 1],
221222
"multiedit" => [\$multiedit, undef],
222-
"annotate" => [\$annotate, undef]
223+
"annotate" => [\$annotate, undef],
224+
"xmailer" => [\$use_xmailer, 1]
223225
);
224226

225227
my %config_settings = (
@@ -318,6 +320,7 @@ sub signal_handler {
318320
"8bit-encoding=s" => \$auto_8bit_encoding,
319321
"compose-encoding=s" => \$compose_encoding,
320322
"force" => \$force,
323+
"xmailer!" => \$use_xmailer,
321324
);
322325

323326
usage() if $help;
@@ -1163,8 +1166,10 @@ sub send_message {
11631166
Subject: $subject
11641167
Date: $date
11651168
Message-Id: $message_id
1166-
X-Mailer: git-send-email $gitversion
11671169
";
1170+
if ($use_xmailer) {
1171+
$header .= "X-Mailer: git-send-email $gitversion\n";
1172+
}
11681173
if ($reply_to) {
11691174

11701175
$header .= "In-Reply-To: $reply_to\n";

0 commit comments

Comments
 (0)