1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

courier: Always have a domain for EHLO/HELO

In the SMTP courier, we should always include a domain when saying hello, as
many MTAs will be pick about it.

An empty domain can happen if the envelope-from is <>. In that case, we fall
back to our hostname.
This commit is contained in:
Alberto Bertogli
2016-10-03 01:03:55 +01:00
parent 0e41821779
commit afd79dfd8d

View File

@@ -4,6 +4,7 @@ import (
"crypto/tls"
"flag"
"net"
"os"
"time"
"github.com/golang/glog"
@@ -69,6 +70,10 @@ retry:
if err != nil {
return tr.Errorf("Sender domain not IDNA compliant: %v", err), true
}
if fromDomain == "" {
// This can happen when sending bounces. Last resort.
fromDomain, _ = os.Hostname()
}
if err = c.Hello(fromDomain); err != nil {
return tr.Errorf("Error saying hello: %v", err), false
}