1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-07 17:47:14 +00:00

courier: Use the senders' domain when saying EHLO

Some servers, like postfix, will pay close attention to the domain we say as a
part of the EHLO.

By default, Go's smtp package will use "localhost", causing it to complain.

This patch fixes that by using the envelope-from's domain.
It's not clear if that's better than using what we are resolving to, but
that's much more involved so we're going to do this for now.
This commit is contained in:
Alberto Bertogli
2016-10-01 18:00:53 +01:00
parent 280939c3ec
commit 2f2d1f2dbd
2 changed files with 11 additions and 5 deletions

View File

@@ -67,6 +67,12 @@ retry:
return tr.Errorf("Error creating client: %v", err), false
}
// Issue an EHLO with a valid domain; otherwise, some servers like postfix
// will complain.
if err = c.Hello(envelope.DomainOf(from)); err != nil {
return tr.Errorf("Error saying hello: %v", err), false
}
// TODO: Keep track of hosts and MXs that we've successfully done TLS
// against, and enforce it.
if ok, _ := c.Extension("STARTTLS"); ok {