{"thread":{"id":"38102","subject":"[PATCH v2] send-email: add --[no-]xmailer option","startedAt":"2014-12-03T18:07:09Z","lastAt":"2014-12-03T18:07:09Z","messageCount":1,"participants":["Luis Henriques"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"252969","messageId":"20141203180709.GA11160@charon.olymp","threadId":"38102","inReplyTo":null,"subject":"[PATCH v2] send-email: add --[no-]xmailer option","fromName":"Luis Henriques","fromEmail":"henrix@camandro.org","sentAt":"2014-12-03T18:07:09Z","receivedAt":"2014-12-03T18:07:09Z","isPatch":true,"sender":{"key":"henrix@camandro.org","avatar":"https://avatars.githubusercontent.com/u/73643340?v=4"},"body":"Add --[no-]xmailer that allows a user to disable adding the 'X-Mailer:'\nheader to the email being sent.\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\nSigned-off-by: Luis Henriques <henrix@camandro.org>\n---\n Documentation/config.txt         |  1 +\n Documentation/git-send-email.txt |  5 +++++\n git-send-email.perl              | 11 +++++++++--\n 3 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 922072596fdd..3f9898931d3b 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2304,6 +2304,7 @@ sendemail.smtpserveroption::\n sendemail.smtpuser::\n sendemail.thread::\n sendemail.validate::\n+sendemail.xmailer::\n \tSee linkgit:git-send-email[1] for description.\n \n sendemail.signedoffcc::\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex a60776eb579e..a0bd806cfed8 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -131,6 +131,11 @@ Note that no attempts whatsoever are made to validate the encoding.\n \tSpecify encoding of compose message. Default is the value of the\n \t'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.\n \n+--xmailer::\n+--no-xmailer::\n+\tAdd (or prevent adding) the \"X-Mailer:\" header.  By default,\n+\tthe header is added, but it can be turned off by setting the\n+\t`sendemail.xmailer` configuration variable to `false`.\n \n Sending\n ~~~~~~~\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 9949db01e119..a6e66b9ae386 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >\n     --[no-]bcc              <str>  * Email Bcc:\n     --subject               <str>  * Email \"Subject:\"\n     --in-reply-to           <str>  * Email \"In-Reply-To:\"\n+    --[no-]xmailer                 * Add \"X-Mailer:\" header (default).\n     --[no-]annotate                * Review each patch that will be sent in an editor.\n     --compose                      * Open an editor for introduction.\n     --compose-encoding      <str>  * Encoding to assume for introduction.\n@@ -176,6 +177,8 @@ my $force = 0;\n my $multiedit;\n my $editor;\n \n+my $use_xmailer;\n+\n sub do_edit {\n \tif (!defined($editor)) {\n \t\t$editor = Git::command_oneline('var', 'GIT_EDITOR');\n@@ -219,7 +222,8 @@ my %config_bool_settings = (\n     \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n     \"validate\" => [\\$validate, 1],\n     \"multiedit\" => [\\$multiedit, undef],\n-    \"annotate\" => [\\$annotate, undef]\n+    \"annotate\" => [\\$annotate, undef],\n+    \"xmailer\" => [\\$use_xmailer, 1]\n );\n \n my %config_settings = (\n@@ -318,6 +322,7 @@ my $rc = GetOptions(\"h\" => \\$help,\n \t\t    \"8bit-encoding=s\" => \\$auto_8bit_encoding,\n \t\t    \"compose-encoding=s\" => \\$compose_encoding,\n \t\t    \"force\" => \\$force,\n+\t\t    \"xmailer!\" => \\$use_xmailer,\n \t );\n \n usage() if $help;\n@@ -1163,8 +1168,10 @@ To: $to${ccline}\n Subject: $subject\n Date: $date\n Message-Id: $message_id\n-X-Mailer: git-send-email $gitversion\n \";\n+\tif ($use_xmailer) {\n+\t\t$header .= \"X-Mailer: git-send-email $gitversion\\n\";\n+\t}\n \tif ($reply_to) {\n \n \t\t$header .= \"In-Reply-To: $reply_to\\n\";\n"}]}