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>

Luis Henriques committed Mar 24, 2014 at 21:38 UTC ac1596a684a44144efa2d52d9104b0d627e6d9a1
3 files changed +14 -3
Documentation/config.txt
+1
@@ -2260,6 +2260,7 @@ sendemail.smtpserveroption::
2260 sendemail.smtpuser::
2261 sendemail.thread::
2262 sendemail.validate::
2263 +sendemail.xmailer::
2264 See linkgit:git-send-email[1] for description.
2265
2266 sendemail.signedoffcc::
Documentation/git-send-email.txt
+5
@@ -131,6 +131,11 @@ Note that no attempts whatsoever are made to validate the encoding.
131 Specify encoding of compose message. Default is the value of the
132 'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
133
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`.
139
140 Sending
141 ~~~~~~~
git-send-email.perl
+8 -3
@@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
54 --[no-]bcc <str> * Email Bcc:
55 --subject <str> * Email "Subject:"
56 --in-reply-to <str> * Email "In-Reply-To:"
57 + --[no-]xmailer * Add "X-Mailer:" header (default).
58 --[no-]annotate * Review each patch that will be sent in an editor.
59 --compose * Open an editor for introduction.
60 --compose-encoding <str> * Encoding to assume for introduction.
@@ -148,7 +149,7 @@ my $auth;
149 # Variables we fill in automatically, or via prompting:
150 my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
151 $initial_reply_to,$initial_subject,@files,
151 - $author,$sender,$smtp_authpass,$annotate,$compose,$time);
152 + $author,$sender,$smtp_authpass,$annotate,$use_xmailer,$compose,$time);
153
154 my $envelope_sender;
155
@@ -219,7 +220,8 @@ my %config_bool_settings = (
220 "signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
221 "validate" => [\$validate, 1],
222 "multiedit" => [\$multiedit, undef],
222 - "annotate" => [\$annotate, undef]
223 + "annotate" => [\$annotate, undef],
224 + "xmailer" => [\$use_xmailer, 1]
225 );
226
227 my %config_settings = (
@@ -318,6 +320,7 @@ my $rc = GetOptions("h" => \$help,
320 "8bit-encoding=s" => \$auto_8bit_encoding,
321 "compose-encoding=s" => \$compose_encoding,
322 "force" => \$force,
323 + "xmailer!" => \$use_xmailer,
324 );
325
326 usage() if $help;
@@ -1163,8 +1166,10 @@ To: $to${ccline}
1166 Subject: $subject
1167 Date: $date
1168 Message-Id: $message_id
1166 -X-Mailer: git-send-email $gitversion
1169 ";
1170 + if ($use_xmailer) {
1171 + $header .= "X-Mailer: git-send-email $gitversion\n";
1172 + }
1173 if ($reply_to) {
1174
1175 $header .= "In-Reply-To: $reply_to\n";