Skip to content

Commit 577051b

Browse files
committed
Merge branch 'fk/sendmail-from-path'
"git send-email" tries to see if the sendmail program is available in /usr/lib and /usr/sbin; extend the list of locations to be checked to also include directories on $PATH. * fk/sendmail-from-path: git-send-email: honor $PATH for sendmail binary
2 parents d22512e + 1ab2fd4 commit 577051b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Documentation/git-send-email.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ a password is obtained using 'git-credential'.
203203
specify a full pathname of a sendmail-like program instead;
204204
the program must support the `-i` option. Default value can
205205
be specified by the `sendemail.smtpServer` configuration
206-
option; the built-in default is `/usr/sbin/sendmail` or
207-
`/usr/lib/sendmail` if such program is available, or
208-
`localhost` otherwise.
206+
option; the built-in default is to search for `sendmail` in
207+
`/usr/sbin`, `/usr/lib` and $PATH if such program is
208+
available, falling back to `localhost` otherwise.
209209

210210
--smtp-server-port=<port>::
211211
Specifies a port different from the default port (SMTP

git-send-email.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,9 @@ sub expand_one_alias {
885885
}
886886

887887
if (!defined $smtp_server) {
888-
foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
888+
my @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );
889+
push @sendmail_paths, map {"$_/sendmail"} split /:/, $ENV{PATH};
890+
foreach (@sendmail_paths) {
889891
if (-x $_) {
890892
$smtp_server = $_;
891893
last;

0 commit comments

Comments
 (0)