Skip to content

Commit

Permalink
send-email: add --[no-]xmailer option
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luis Henriques authored and Junio C Hamano committed Dec 15, 2014
1 parent 7fa1365 commit ac1596a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ sendemail.smtpserveroption::
sendemail.smtpuser::
sendemail.thread::
sendemail.validate::
sendemail.xmailer::
See linkgit:git-send-email[1] for description.

sendemail.signedoffcc::
Expand Down
5 changes: 5 additions & 0 deletions Documentation/git-send-email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ Note that no attempts whatsoever are made to validate the encoding.
Specify encoding of compose message. Default is the value of the
'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.

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

Sending
~~~~~~~
Expand Down
11 changes: 8 additions & 3 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sub usage {
--[no-]bcc <str> * Email Bcc:
--subject <str> * Email "Subject:"
--in-reply-to <str> * Email "In-Reply-To:"
--[no-]xmailer * Add "X-Mailer:" header (default).
--[no-]annotate * Review each patch that will be sent in an editor.
--compose * Open an editor for introduction.
--compose-encoding <str> * Encoding to assume for introduction.
Expand Down Expand Up @@ -148,7 +149,7 @@ sub format_2822_time {
# Variables we fill in automatically, or via prompting:
my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
$initial_reply_to,$initial_subject,@files,
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
$author,$sender,$smtp_authpass,$annotate,$use_xmailer,$compose,$time);

my $envelope_sender;

Expand Down Expand Up @@ -219,7 +220,8 @@ sub do_edit {
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
"validate" => [\$validate, 1],
"multiedit" => [\$multiedit, undef],
"annotate" => [\$annotate, undef]
"annotate" => [\$annotate, undef],
"xmailer" => [\$use_xmailer, 1]
);

my %config_settings = (
Expand Down Expand Up @@ -318,6 +320,7 @@ sub signal_handler {
"8bit-encoding=s" => \$auto_8bit_encoding,
"compose-encoding=s" => \$compose_encoding,
"force" => \$force,
"xmailer!" => \$use_xmailer,
);

usage() if $help;
Expand Down Expand Up @@ -1163,8 +1166,10 @@ sub send_message {
Subject: $subject
Date: $date
Message-Id: $message_id
X-Mailer: git-send-email $gitversion
";
if ($use_xmailer) {
$header .= "X-Mailer: git-send-email $gitversion\n";
}
if ($reply_to) {

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

0 comments on commit ac1596a

Please sign in to comment.