···11diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
22-index 1afe9fc858..05dd7c3a90 100644
22+index 3db4eab4ba..39bc0e77c9 100644
33--- a/Documentation/git-send-email.txt
44+++ b/Documentation/git-send-email.txt
55-@@ -215,8 +215,7 @@ a password is obtained using 'git-credential'.
66- specify a full pathname of a sendmail-like program instead;
77- the program must support the `-i` option. Default value can
88- be specified by the `sendemail.smtpServer` configuration
99-- option; the built-in default is to search for `sendmail` in
1010-- `/usr/sbin`, `/usr/lib` and $PATH if such program is
1111-+ option; the built-in default is to search in $PATH if such program is
1212- available, falling back to `localhost` otherwise.
1313-1414- --smtp-server-port=<port>::
55+@@ -220,9 +220,9 @@ a password is obtained using 'git-credential'.
66+ --smtp-server=<host>::
77+ If set, specifies the outgoing SMTP server to use (e.g.
88+ `smtp.example.com` or a raw IP address). If unspecified, and if
99+- `--sendmail-cmd` is also unspecified, the default is to search
1010+- for `sendmail` in `/usr/sbin`, `/usr/lib` and $PATH if such a
1111+- program is available, falling back to `localhost` otherwise.
1212++ `--sendmail-cmd` is also unspecified, the default is to search for
1313++ `sendmail` in $PATH if such a program is available, falling back to
1414++ `localhost` otherwise.
1515+ +
1616+ For backward compatibility, this option can also specify a full pathname
1717+ of a sendmail-like program instead; the program must support the `-i`
1518diff --git a/git-send-email.perl b/git-send-email.perl
1616-index 8eb63b5a2f..74a61d8213 100755
1919+index e65d969d0b..508d49483d 100755
1720--- a/git-send-email.perl
1821+++ b/git-send-email.perl
1919-@@ -956,8 +956,7 @@ sub expand_one_alias {
2222+@@ -1066,8 +1066,7 @@ sub expand_one_alias {
2023 }
21242222- if (!defined $smtp_server) {
2525+ if (!defined $sendmail_cmd && !defined $smtp_server) {
2326- my @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );
2427- push @sendmail_paths, map {"$_/sendmail"} split /:/, $ENV{PATH};
2528+ my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
2629 foreach (@sendmail_paths) {
2730 if (-x $_) {
2828- $smtp_server = $_;
3131+ $sendmail_cmd = $_;