# How can I specify the "sendmail" program for git-send-email?

9 messages from 2012-06-11 to 2012-06-11. Participants: Richard Yang, Erik Faye-Lund, konglu@minatec.inpg.fr, Junio C Hamano.
Thread: https://gitlist.dev/t/30762

## Richard Yang, 2012-06-11 07:32

Subject: How can I specify the "sendmail" program for git-send-email?
Message-ID: <20120611073232.GA5602@richard>
URL: https://gitlist.dev/e/20120611073232.GA5602%40richard

```
Hi, experts

I read the git-send-email manual and find the --smtp-server option can
specify the sendmail-like program to send mail.

Then I use this option in command line 
--smtp-server=/usr/bin/msmtp
This works.

While I found it not very convenient to write the option on command line
every time, then I wrote it in the .gitconfig file in my home directory.

[sendmail]
	smtpserver = /usr/bin/msmtp
	smtppass       = 123456
	smtpuser       = weiyang@linux.vnet.ibm.com
        smtpserverport = 143

While this time I don't use the --smtp-server option in command line. 

And seems this time, it doesn't use the msmpt to send mail, since this
time it fails.

Then my second approach is not correct? 

-- 
Richard Yang
Help you, Help me

```

## Erik Faye-Lund, 2012-06-11 08:23

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <CABPQNSbwtP0hp8QYznwXjLAaoKVj_ZUWXQQCDG80Xb+TME1MWw@mail.gmail.com>
URL: https://gitlist.dev/e/CABPQNSbwtP0hp8QYznwXjLAaoKVj_ZUWXQQCDG80Xb%2BTME1MWw%40mail.gmail.com
In-Reply-To: <20120611073232.GA5602@richard>

```
On Mon, Jun 11, 2012 at 9:32 AM, Richard Yang
<weiyang@linux.vnet.ibm.com> wrote:
> Hi, experts
>
> I read the git-send-email manual and find the --smtp-server option can
> specify the sendmail-like program to send mail.
>
> Then I use this option in command line
> --smtp-server=/usr/bin/msmtp
> This works.
>
> While I found it not very convenient to write the option on command line
> every time, then I wrote it in the .gitconfig file in my home directory.
>
> [sendmail]
>        smtpserver = /usr/bin/msmtp
>        smtppass       = 123456
>        smtpuser       = weiyang@linux.vnet.ibm.com
>        smtpserverport = 143

The configuration-section for git send-mail is actually spelled
"sendemail", and not "sendmail". Notice the additional 'e'.

http://git-scm.com/docs/git-send-email

```

## Richard Yang, 2012-06-11 09:04

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <20120611090431.GA23447@richard>
URL: https://gitlist.dev/e/20120611090431.GA23447%40richard
In-Reply-To: <CABPQNSbwtP0hp8QYznwXjLAaoKVj_ZUWXQQCDG80Xb+TME1MWw@mail.gmail.com>

```
On Mon, Jun 11, 2012 at 10:23:21AM +0200, Erik Faye-Lund wrote:
>On Mon, Jun 11, 2012 at 9:32 AM, Richard Yang
><weiyang@linux.vnet.ibm.com> wrote:
>> Hi, experts
>>
>> I read the git-send-email manual and find the --smtp-server option can
>> specify the sendmail-like program to send mail.
>>
>> Then I use this option in command line
>> --smtp-server=/usr/bin/msmtp
>> This works.
>>
>> While I found it not very convenient to write the option on command line
>> every time, then I wrote it in the .gitconfig file in my home directory.
>>
>> [sendmail]
>>        smtpserver = /usr/bin/msmtp
>>        smtppass       = 123456
>>        smtpuser       = weiyang@linux.vnet.ibm.com
>>        smtpserverport = 143
>
>The configuration-section for git send-mail is actually spelled
>"sendemail", and not "sendmail". Notice the additional 'e'.
Oops, a stupid mistake.

Thanks all :)
>
>http://git-scm.com/docs/git-send-email

-- 
Richard Yang
Help you, Help me

```

## Erik Faye-Lund, 2012-06-11 09:15

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <CABPQNSZ1dyAfCVLGcLxbeBdS_9A_arYOhzgKBtndReK5zxu_MA@mail.gmail.com>
URL: https://gitlist.dev/e/CABPQNSZ1dyAfCVLGcLxbeBdS_9A_arYOhzgKBtndReK5zxu_MA%40mail.gmail.com
In-Reply-To: <20120611090431.GA23447@richard>

```
On Mon, Jun 11, 2012 at 11:04 AM, Richard Yang
<weiyang@linux.vnet.ibm.com> wrote:
> On Mon, Jun 11, 2012 at 10:23:21AM +0200, Erik Faye-Lund wrote:
>>On Mon, Jun 11, 2012 at 9:32 AM, Richard Yang
>><weiyang@linux.vnet.ibm.com> wrote:
>>> Hi, experts
>>>
>>> I read the git-send-email manual and find the --smtp-server option can
>>> specify the sendmail-like program to send mail.
>>>
>>> Then I use this option in command line
>>> --smtp-server=/usr/bin/msmtp
>>> This works.
>>>
>>> While I found it not very convenient to write the option on command line
>>> every time, then I wrote it in the .gitconfig file in my home directory.
>>>
>>> [sendmail]
>>>        smtpserver = /usr/bin/msmtp
>>>        smtppass       = 123456
>>>        smtpuser       = weiyang@linux.vnet.ibm.com
>>>        smtpserverport = 143
>>
>>The configuration-section for git send-mail is actually spelled
>>"sendemail", and not "sendmail". Notice the additional 'e'.
> Oops, a stupid mistake.
>
> Thanks all :)

Well, I've always been slightly annoyed by the "send-mail" vs
"sendemail" inconsistency. Perhaps we could do something along these
lines (plus all documentation-updates, omitted for clarity) to reduce
the risk of confusion?

Yeah, the leaking of $identity between different sections is a bit
suboptimal, but as a fallback-mechanism I don't think it actually
matters much.

diff --git a/git-send-email.perl b/git-send-email.perl
index 03292fd..d167d96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -375,7 +375,11 @@ sub read_config {
 	}
 }

-# read configuration from [sendemail "$identity"], fall back on [sendemail]
+# read configuration from [sendmail "$identity"], fall back on [sendmail]
+$identity = Git::config(@repo, "sendmail.identity") unless (defined $identity);
+read_config("sendmail.$identity") if (defined $identity);
+read_config("sendmail");
+# same as above, but with legacy "sendemail"
 $identity = Git::config(@repo, "sendemail.identity") unless (defined
$identity);
 read_config("sendemail.$identity") if (defined $identity);
 read_config("sendemail");

```

## konglu@minatec.inpg.fr, 2012-06-11 09:25

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <20120611112516.Horde.jg0rcXwdC4BP1bl8bOMwLoA@webmail.minatec.grenoble-inp.fr>
URL: https://gitlist.dev/e/20120611112516.Horde.jg0rcXwdC4BP1bl8bOMwLoA%40webmail.minatec.grenoble-inp.fr
In-Reply-To: <CABPQNSZ1dyAfCVLGcLxbeBdS_9A_arYOhzgKBtndReK5zxu_MA@mail.gmail.com>

```

Erik Faye-Lund <kusmabite@gmail.com> a écrit :

> Well, I've always been slightly annoyed by the "send-mail" vs
> "sendemail" inconsistency. Perhaps we could do something along these
> lines (plus all documentation-updates, omitted for clarity) to reduce
> the risk of confusion?
>
> Yeah, the leaking of $identity between different sections is a bit
> suboptimal, but as a fallback-mechanism I don't think it actually
> matters much.

[...]

> -# read configuration from [sendemail "$identity"], fall back on [sendemail]
> +# read configuration from [sendmail "$identity"], fall back on [sendmail]
> +$identity = Git::config(@repo, "sendmail.identity") unless (defined  
> $identity);
> +read_config("sendmail.$identity") if (defined $identity);
> +read_config("sendmail");
> +# same as above, but with legacy "sendemail"
>  $identity = Git::config(@repo, "sendemail.identity") unless (defined
> $identity);
>  read_config("sendemail.$identity") if (defined $identity);
>  read_config("sendemail");

I'm not very familiar with perl, but do you mean to replace "sendemail" by
"sendmail" or just make "sendmail" usable in the config file, along with
"sendemail" ?

```

## Erik Faye-Lund, 2012-06-11 09:45

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <CABPQNSYYsNTxPRhL5LM_c-KcruAhzKmqvDTNzpS09ukpQ=sbvw@mail.gmail.com>
URL: https://gitlist.dev/e/CABPQNSYYsNTxPRhL5LM_c-KcruAhzKmqvDTNzpS09ukpQ%3Dsbvw%40mail.gmail.com
In-Reply-To: <20120611112516.Horde.jg0rcXwdC4BP1bl8bOMwLoA@webmail.minatec.grenoble-inp.fr>

```
On Mon, Jun 11, 2012 at 11:25 AM,  <konglu@minatec.inpg.fr> wrote:
>
> Erik Faye-Lund <kusmabite@gmail.com> a écrit :
>
>
>> Well, I've always been slightly annoyed by the "send-mail" vs
>> "sendemail" inconsistency. Perhaps we could do something along these
>> lines (plus all documentation-updates, omitted for clarity) to reduce
>> the risk of confusion?
>>
>> Yeah, the leaking of $identity between different sections is a bit
>> suboptimal, but as a fallback-mechanism I don't think it actually
>> matters much.
>
>
> [...]
>
>
>> -# read configuration from [sendemail "$identity"], fall back on
>> [sendemail]
>> +# read configuration from [sendmail "$identity"], fall back on [sendmail]
>> +$identity = Git::config(@repo, "sendmail.identity") unless (defined
>> $identity);
>> +read_config("sendmail.$identity") if (defined $identity);
>> +read_config("sendmail");
>> +# same as above, but with legacy "sendemail"
>>  $identity = Git::config(@repo, "sendemail.identity") unless (defined
>> $identity);
>>  read_config("sendemail.$identity") if (defined $identity);
>>  read_config("sendemail");
>
>
> I'm not very familiar with perl, but do you mean to replace "sendemail" by
> "sendmail" or just make "sendmail" usable in the config file, along with
> "sendemail" ?

I meant to switch to "sendmail", but keep "sendemail" around to be
backwards compatible. At some point in the future it might make sense
to remove the support for "sendemail", though.

```

## konglu@minatec.inpg.fr, 2012-06-11 10:13

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <20120611121335.Horde.NUDqUXwdC4BP1cTP77JwT6A@webmail.minatec.grenoble-inp.fr>
URL: https://gitlist.dev/e/20120611121335.Horde.NUDqUXwdC4BP1cTP77JwT6A%40webmail.minatec.grenoble-inp.fr
In-Reply-To: <CABPQNSYYsNTxPRhL5LM_c-KcruAhzKmqvDTNzpS09ukpQ=sbvw@mail.gmail.com>

```

Erik Faye-Lund <kusmabite@gmail.com> a écrit :

> I meant to switch to "sendmail", but keep "sendemail" around to be
> backwards compatible.

Sounds good to me. That would avoid everyone to change their config file
and, for those who haven't set [sendemail], it would be more natural to
type "sendmail" than "sendemail" (that's my personal opinion though).

```

## Junio C Hamano, 2012-06-11 15:57

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <7v4nqh96z5.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4nqh96z5.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CABPQNSZ1dyAfCVLGcLxbeBdS_9A_arYOhzgKBtndReK5zxu_MA@mail.gmail.com>

```
Erik Faye-Lund <kusmabite@gmail.com> writes:

> Well, I've always been slightly annoyed by the "send-mail" vs
> "sendemail" inconsistency.

Hrm, isn't it between "sendmail" (as in /usr/lib/sendmail) and
"send-email" (a subcommand of git)?

> Perhaps we could do something along these
> lines (plus all documentation-updates, omitted for clarity) to reduce
> the risk of confusion?

Assuming that the contrast between "sendmail" and "git send-email"
is what you are trying to address, I fail to see how it would help
reducing the confusion if you start naming configuration variables
used by "git send-email" without E.

If the proposal were to give "send-email.$var" synomyms to
corresponding "sendemail.$var" variables, I would have been
persuaded to believe it may alleviate potential confusion, though.

> Yeah, the leaking of $identity between different sections is a bit
> suboptimal, but as a fallback-mechanism I don't think it actually
> matters much.
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 03292fd..d167d96 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -375,7 +375,11 @@ sub read_config {
>  	}
>  }
>
> -# read configuration from [sendemail "$identity"], fall back on [sendemail]
> +# read configuration from [sendmail "$identity"], fall back on [sendmail]
> +$identity = Git::config(@repo, "sendmail.identity") unless (defined $identity);
> +read_config("sendmail.$identity") if (defined $identity);
> +read_config("sendmail");
> +# same as above, but with legacy "sendemail"
>  $identity = Git::config(@repo, "sendemail.identity") unless (defined
> $identity);
>  read_config("sendemail.$identity") if (defined $identity);
>  read_config("sendemail");

```

## Erik Faye-Lund, 2012-06-11 16:25

Subject: Re: How can I specify the "sendmail" program for git-send-email?
Message-ID: <CABPQNSaLtdGVfdkQyRFn4_Ze84zGVuvPwxTpr3hY8uDc0WU2Zg@mail.gmail.com>
URL: https://gitlist.dev/e/CABPQNSaLtdGVfdkQyRFn4_Ze84zGVuvPwxTpr3hY8uDc0WU2Zg%40mail.gmail.com
In-Reply-To: <7v4nqh96z5.fsf@alter.siamese.dyndns.org>

```
On Mon, Jun 11, 2012 at 5:57 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> Well, I've always been slightly annoyed by the "send-mail" vs
>> "sendemail" inconsistency.
>
> Hrm, isn't it between "sendmail" (as in /usr/lib/sendmail) and
> "send-email" (a subcommand of git)?
>

Ugh, you are right. My brain must have been defective :)

>> Perhaps we could do something along these
>> lines (plus all documentation-updates, omitted for clarity) to reduce
>> the risk of confusion?
>
> Assuming that the contrast between "sendmail" and "git send-email"
> is what you are trying to address, I fail to see how it would help
> reducing the confusion if you start naming configuration variables
> used by "git send-email" without E.
>

No, this was just me being a moron.

> If the proposal were to give "send-email.$var" synomyms to
> corresponding "sendemail.$var" variables, I would have been
> persuaded to believe it may alleviate potential confusion, though.

This was really the way I wanted to go, but I somehow got unsure about
the legality of the dashes in config sections. I'm a bit skeptical to
introducing new non-letter characters if we don't have to.

So let's just drop my suggestion. I wasn't thinking straight.

```
