git-send-email: add option to specify sendmail command
authorGregory Anders <greg@gpanders.com>
Fri, 14 May 2021 15:15:53 +0000 (09:15 -0600)
committerJunio C Hamano <gitster@pobox.com>
Sun, 16 May 2021 22:06:13 +0000 (07:06 +0900)
commitcd5b33fbdc0299765278d0b607b64202603f0882
treefa42252cddb0b168ffadbe75f5c94a7e3b0b424c
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7
git-send-email: add option to specify sendmail command

The sendemail.smtpServer configuration option and --smtp-server command
line option both support using a sendmail-like program to send emails by
specifying an absolute file path. However, this is not ideal for the
following reasons:

1. It overloads the meaning of smtpServer (now a program is being used
   for the server?)
2. It doesn't allow for non-absolute paths, arguments, or arbitrary
   scripting

Requiring an absolute path is bad for portability, as the same program
may be in different locations on different systems. If a user wishes to
pass arguments to their program, they have to use the smtpServerOption
option, which is cumbersome (as it must be repeated for each option) and
doesn't adhere to normal git conventions.

Introduce a new configuration option sendemail.sendmailCmd as well as a
command line option --sendmail-cmd that can be used to specify a command
(with or without arguments) or shell expression to run to send email.
The name of this option is consistent with --to-cmd and --cc-cmd. This
invocation honors the user's $PATH so that absolute paths are not
necessary. Arbitrary shell expressions are also supported, allowing
users to do basic scripting.

Give this option a higher precedence over --smtp-server and
sendemail.smtpServer, as the new interface is more flexible. For
backward compatibility, continue to support absolute paths in
--smtp-server and sendemail.smtpServer.

Signed-off-by: Gregory Anders <greg@gpanders.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-send-email.txt
git-send-email.perl
t/t9001-send-email.sh