# send-email issue

13 messages from 2021-08-13 to 2021-08-24. Participants: Ben Goldberg, Konstantin Ryabitsev, Junio C Hamano, Jeff King, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/56279

## Ben Goldberg, 2021-08-13 17:50

Subject: send-email issue
Message-ID: <24a88faf-5339-8449-80c4-f6085bd1e098@benaaron.dev>
URL: https://gitlist.dev/e/24a88faf-5339-8449-80c4-f6085bd1e098%40benaaron.dev

```
Hello,

I hope this is right place to ask this kind of question.
When I try to use get send-email I get:
ˋˋˋ
Unable to initialize SMTP properly. Check config and use --smtp-debug. 
VALUES: server=smtp.migadu.com encryption=tls 
hello=localhost.localdomain port=465 at /usr/lib/git-core/git-send-email 
line 1583.
ˋˋˋ
I used to be able to use send-email on this machine so I'm not sure why 
it's not wokring now. I'm able to send email using that account using 
Thunderbird on this machine, so I don't think it's a network issue. And 
I double checked my smtp config.

Thx,
Ben

```

## Ben Goldberg, 2021-08-13 17:57

Subject: Re: send-email issue
Message-ID: <b4b1dda4-6bf7-f4b1-88c5-9d579a7c56d3@benaaron.dev>
URL: https://gitlist.dev/e/b4b1dda4-6bf7-f4b1-88c5-9d579a7c56d3%40benaaron.dev
In-Reply-To: <24a88faf-5339-8449-80c4-f6085bd1e098@benaaron.dev>

```
A little additional info. When I run send-email with --smtp-debug=1 I 
get this.
ˋˋˋ
Net::SMTP>>> Net::SMTP(3.13)
Net::SMTP>>>   Net::Cmd(3.13)
Net::SMTP>>>     Exporter(5.76)
Net::SMTP>>>   IO::Socket::IP(0.41)
Net::SMTP>>>     IO::Socket(1.46)
Net::SMTP>>>       IO::Handle(1.46)
Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel:  at 
/usr/lib/git-core/git-send-email line 1556.
Unable to initialize SMTP properly. Check config and use --smtp-debug. 
VALUES: server=smtp.migadu.com encryption=tls 
hello=localhost.localdomain port=465 at /usr/lib/git-core/git-send-email 
line 1583.
ˋˋˋ

Hope that helps.

```

## Ben Goldberg, 2021-08-13 18:00

Subject: Re: send-email issue
Message-ID: <9207c356-6c5f-d5d8-4862-a6131b4db8dc@benaaron.dev>
URL: https://gitlist.dev/e/9207c356-6c5f-d5d8-4862-a6131b4db8dc%40benaaron.dev
In-Reply-To: <b4b1dda4-6bf7-f4b1-88c5-9d579a7c56d3@benaaron.dev>

```
Oh, and I'm running git version 2.32.0

```

## Konstantin Ryabitsev, 2021-08-13 18:00

Subject: Re: send-email issue
Message-ID: <20210813180056.ctzivmakj4bj5apa@nitro.local>
URL: https://gitlist.dev/e/20210813180056.ctzivmakj4bj5apa%40nitro.local
In-Reply-To: <b4b1dda4-6bf7-f4b1-88c5-9d579a7c56d3@benaaron.dev>

```
On Fri, Aug 13, 2021 at 01:57:13PM -0400, Ben Goldberg wrote:
> ˋˋˋ
> Net::SMTP>>> Net::SMTP(3.13)
> Net::SMTP>>>   Net::Cmd(3.13)
> Net::SMTP>>>     Exporter(5.76)
> Net::SMTP>>>   IO::Socket::IP(0.41)
> Net::SMTP>>>     IO::Socket(1.46)
> Net::SMTP>>>       IO::Handle(1.46)
> Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel:  at
> /usr/lib/git-core/git-send-email line 1556.
> Unable to initialize SMTP properly. Check config and use --smtp-debug.
> VALUES: server=smtp.migadu.com encryption=tls hello=localhost.localdomain
> port=465 at /usr/lib/git-core/git-send-email line 1583.
> ˋˋˋ

You should use:

port=465
encryption=ssl

OR

port=587
encryption=tls

I know that this is confusing terminology, but "tls" stands for "StartTLS",
which works on port 587, and "ssl" starts for "smtps" on port 465.

-K

```

## Ben Goldberg, 2021-08-13 18:03

Subject: Re: send-email issue
Message-ID: <f7ee6a03-74f2-152e-5158-4103c744595a@benaaron.dev>
URL: https://gitlist.dev/e/f7ee6a03-74f2-152e-5158-4103c744595a%40benaaron.dev
In-Reply-To: <20210813180056.ctzivmakj4bj5apa@nitro.local>

```
> 
> You should use:
> 
> port=465
> encryption=ssl
> 
> OR
> 
> port=587
> encryption=tls
> 
> I know that this is confusing terminology, but "tls" stands for "StartTLS",
> which works on port 587, and "ssl" starts for "smtps" on port 465.
> 

That worked! Thanks so much for your help!


```

## Junio C Hamano, 2021-08-14 23:36

Subject: Re: send-email issue
Message-ID: <xmqq35rbtx84.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq35rbtx84.fsf%40gitster.g
In-Reply-To: <20210813180056.ctzivmakj4bj5apa@nitro.local>

```
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:

> I know that this is confusing terminology, but "tls" stands for "StartTLS",
> which works on port 587, and "ssl" starts for "smtps" on port 465.

This reminds me of an earlier discussion we had that somehow petered
out before it resuted in usable improvement,

  https://lore.kernel.org/git/xmqqtuo9kgo0.fsf@gitster.g/

I do not think it is feasible to immediately rename the two choices
to SSL/TLS vs StartTLS without transition period, but the first
patch in the three-patch series there to update the documentation
alone may have helped this case.

We may also want to error out when seeing an unknown option other
than 'ssl' and 'tls', as the necessary first step to make it
possible to later safely accept StartTLS as a synonym for 'tls' and
'ssl/tls' as a synonym for 'ssl'.


```

## Konstantin Ryabitsev, 2021-08-16 13:11

Subject: Re: send-email issue
Message-ID: <20210816131143.6ifcbpxp6ilo2nv5@nitro.local>
URL: https://gitlist.dev/e/20210816131143.6ifcbpxp6ilo2nv5%40nitro.local
In-Reply-To: <xmqq35rbtx84.fsf@gitster.g>

```
On Sat, Aug 14, 2021 at 04:36:43PM -0700, Junio C Hamano wrote:
> Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
> 
> > I know that this is confusing terminology, but "tls" stands for "StartTLS",
> > which works on port 587, and "ssl" starts for "smtps" on port 465.
> 
> This reminds me of an earlier discussion we had that somehow petered
> out before it resuted in usable improvement,
> 
>   https://lore.kernel.org/git/xmqqtuo9kgo0.fsf@gitster.g/
> 
> I do not think it is feasible to immediately rename the two choices
> to SSL/TLS vs StartTLS without transition period, but the first
> patch in the three-patch series there to update the documentation
> alone may have helped this case.
> 
> We may also want to error out when seeing an unknown option other
> than 'ssl' and 'tls', as the necessary first step to make it
> possible to later safely accept StartTLS as a synonym for 'tls' and
> 'ssl/tls' as a synonym for 'ssl'.

Is it easier to just add less ambiguous aliases, eventually phasing out old
terminology?

tls -> starttls
ssl -> smtps

This way we don't have to change anything, and "smtps" is a valid way to refer
to smtp over ssl (e.g. see /etc/services for 465/tcp).

-K

```

## Jeff King, 2021-08-16 16:19

Subject: Re: send-email issue
Message-ID: <YRqQJTyBW6j6b2pW@coredump.intra.peff.net>
URL: https://gitlist.dev/e/YRqQJTyBW6j6b2pW%40coredump.intra.peff.net
In-Reply-To: <20210816131143.6ifcbpxp6ilo2nv5@nitro.local>

```
On Mon, Aug 16, 2021 at 09:11:43AM -0400, Konstantin Ryabitsev wrote:

> > I do not think it is feasible to immediately rename the two choices
> > to SSL/TLS vs StartTLS without transition period, but the first
> > patch in the three-patch series there to update the documentation
> > alone may have helped this case.
> > 
> > We may also want to error out when seeing an unknown option other
> > than 'ssl' and 'tls', as the necessary first step to make it
> > possible to later safely accept StartTLS as a synonym for 'tls' and
> > 'ssl/tls' as a synonym for 'ssl'.
> 
> Is it easier to just add less ambiguous aliases, eventually phasing out old
> terminology?
> 
> tls -> starttls
> ssl -> smtps
> 
> This way we don't have to change anything, and "smtps" is a valid way to refer
> to smtp over ssl (e.g. see /etc/services for 465/tcp).

FWIW, those options make quite a bit of sense to me (and I agree the
transition to them would be easy).

-Peff

```

## Junio C Hamano, 2021-08-16 16:51

Subject: Re: send-email issue
Message-ID: <xmqq4kbps58l.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq4kbps58l.fsf%40gitster.g
In-Reply-To: <YRqQJTyBW6j6b2pW@coredump.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> On Mon, Aug 16, 2021 at 09:11:43AM -0400, Konstantin Ryabitsev wrote:
>
>> > I do not think it is feasible to immediately rename the two choices
>> > to SSL/TLS vs StartTLS without transition period, but the first
>> > patch in the three-patch series there to update the documentation
>> > alone may have helped this case.
>> > 
>> > We may also want to error out when seeing an unknown option other
>> > than 'ssl' and 'tls', as the necessary first step to make it
>> > possible to later safely accept StartTLS as a synonym for 'tls' and
>> > 'ssl/tls' as a synonym for 'ssl'.
>> 
>> Is it easier to just add less ambiguous aliases, eventually phasing out old
>> terminology?

There is no issue around ambiguity.  The problem is that the code
does not complain a bogus value in $smtp_encryption---when it is
'ssl', ssmtp gets used, when it is 'tls', StartTLS gets used,
otherwise we do not see any errors.

>> tls -> starttls
>> ssl -> smtps
>> 
>> This way we don't have to change anything, and "smtps" is a valid way to refer
>> to smtp over ssl (e.g. see /etc/services for 465/tcp).
>
> FWIW, those options make quite a bit of sense to me (and I agree the
> transition to them would be easy).

Back when we had the original discussion in April [*], I think we
found one small glitch that we need to solve before we can start
introducing aliases---setting the variable to unknown value (imagine
you set it to 'starttls' and then run a version of Git that does not
know it yet) does not make Git barf but silently ignore.  

And that needs to be changed to die, and versions of Git with such a
change, without any alias added, should be allowed to spread to
eradicate the "silently ignore" version, before we can safely start
adding aliases.

Other than that, the transition is not harder than any other
transition we've done in the past.


[Reference]

* https://lore.kernel.org/git/xmqqtuo9kgo0.fsf@gitster.g/

```

## Jeff King, 2021-08-16 16:57

Subject: Re: send-email issue
Message-ID: <YRqY4Tw4YxbepuFg@coredump.intra.peff.net>
URL: https://gitlist.dev/e/YRqY4Tw4YxbepuFg%40coredump.intra.peff.net
In-Reply-To: <xmqq4kbps58l.fsf@gitster.g>

```
On Mon, Aug 16, 2021 at 09:51:06AM -0700, Junio C Hamano wrote:

> >> tls -> starttls
> >> ssl -> smtps
> >> 
> >> This way we don't have to change anything, and "smtps" is a valid way to refer
> >> to smtp over ssl (e.g. see /etc/services for 465/tcp).
> >
> > FWIW, those options make quite a bit of sense to me (and I agree the
> > transition to them would be easy).
> 
> Back when we had the original discussion in April [*], I think we
> found one small glitch that we need to solve before we can start
> introducing aliases---setting the variable to unknown value (imagine
> you set it to 'starttls' and then run a version of Git that does not
> know it yet) does not make Git barf but silently ignore.
> 
> And that needs to be changed to die, and versions of Git with such a
> change, without any alias added, should be allowed to spread to
> eradicate the "silently ignore" version, before we can safely start
> adding aliases.

This is certainly unfortunate, but IMHO is not a hard requirement for
adding new values. This is no different than a case where we add a new
config option, but old versions of Git quietly ignore it.

In other words, I would suggest to tighten this as the values are added,
but not worry about having a "spreading" period.

-Peff

```

## Junio C Hamano, 2021-08-16 18:52

Subject: Re: send-email issue
Message-ID: <xmqqzgthql1h.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqzgthql1h.fsf%40gitster.g
In-Reply-To: <YRqY4Tw4YxbepuFg@coredump.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> This is certainly unfortunate, but IMHO is not a hard requirement for
> adding new values. This is no different than a case where we add a new
> config option, but old versions of Git quietly ignore it.
>
> In other words, I would suggest to tighten this as the values are added,
> but not worry about having a "spreading" period.

I would have agreed with you even in April if this knob were not
about security.  Thinking that the user is asking for an encrypted
connection and silently getting an unencrypted connection is not
such a good thing, and advertising "we now improved the distinction
between smtps and starttls easier to express" to users would not
work well in that context.


```

## Ævar Arnfjörð Bjarmason, 2021-08-23 14:49

Subject: Re: send-email issue
Message-ID: <87eeakfc6b.fsf@evledraar.gmail.com>
URL: https://gitlist.dev/e/87eeakfc6b.fsf%40evledraar.gmail.com
In-Reply-To: <xmqqzgthql1h.fsf@gitster.g>

```

On Mon, Aug 16 2021, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
>
>> This is certainly unfortunate, but IMHO is not a hard requirement for
>> adding new values. This is no different than a case where we add a new
>> config option, but old versions of Git quietly ignore it.
>>
>> In other words, I would suggest to tighten this as the values are added,
>> but not worry about having a "spreading" period.
>
> I would have agreed with you even in April if this knob were not
> about security.  Thinking that the user is asking for an encrypted
> connection and silently getting an unencrypted connection is not
> such a good thing, and advertising "we now improved the distinction
> between smtps and starttls easier to express" to users would not
> work well in that context.

I think per
https://lore.kernel.org/git/87o8ejej8m.fsf@evledraar.gmail.com/ that
this may not be much of an issue in practice, i.e. assuming that most
modern servers only accept auth over the encrypted channel the user will
get an error anyway.

But how true that is in the wild beyond just the GMail example, I don't
know...

```

## Junio C Hamano, 2021-08-24 21:45

Subject: Re: send-email issue
Message-ID: <xmqq8s0qms9p.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq8s0qms9p.fsf%40gitster.g
In-Reply-To: <87eeakfc6b.fsf@evledraar.gmail.com>

```
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> I think per
> https://lore.kernel.org/git/87o8ejej8m.fsf@evledraar.gmail.com/ that
> this may not be much of an issue in practice, i.e. assuming that most
> modern servers only accept auth over the encrypted channel the user will
> get an error anyway.

Let's see how it goes.  It may be wishful thinking but it would lead
to the easiest/simplest solution.



```
