···1+From 9a4396ddaedaf59ebee16d69900884e990b79cdd Mon Sep 17 00:00:00 2001
2+From: Florian Klink <flokli@flokli.de>
3+Date: Fri, 17 Nov 2017 13:21:37 +0100
4+Subject: [PATCH] git-send-email: honor $PATH
5+6+This will search $PATH for a sendmail binary, instead of the (previously
7+fixed) list of paths.
8+9+Signed-off-by: Florian Klink <flokli@flokli.de>
10+---
11+ Documentation/git-send-email.txt | 5 ++---
12+ git-send-email.perl | 3 ++-
13+ 2 files changed, 4 insertions(+), 4 deletions(-)
14+15+diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
16+index bac9014ac..b9b1f2c41 100644
17+--- a/Documentation/git-send-email.txt
18++++ b/Documentation/git-send-email.txt
19+@@ -203,9 +203,8 @@ a password is obtained using 'git-credential'.
20+ specify a full pathname of a sendmail-like program instead;
21+ the program must support the `-i` option. Default value can
22+ be specified by the `sendemail.smtpServer` configuration
23+- option; the built-in default is `/usr/sbin/sendmail` or
24+- `/usr/lib/sendmail` if such program is available, or
25+- `localhost` otherwise.
26++ option; the built-in default is to search in $PATH if such program is
27++ available, or `localhost` otherwise.
28+29+ --smtp-server-port=<port>::
30+ Specifies a port different from the default port (SMTP
31+diff --git a/git-send-email.perl b/git-send-email.perl
32+index 2208dcc21..8e357aeab 100755
33+--- a/git-send-email.perl
34++++ b/git-send-email.perl
35+@@ -885,7 +885,8 @@ if (defined $initial_reply_to) {
36+ }
37+38+ if (!defined $smtp_server) {
39+- foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
40++ my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
41++ foreach (@sendmail_paths) {
42+ if (-x $_) {
43+ $smtp_server = $_;
44+ last;
45+--
46+2.15.0
47+