mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +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:
@@ -4,6 +4,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"flag"
|
"flag"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@@ -69,6 +70,10 @@ retry:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return tr.Errorf("Sender domain not IDNA compliant: %v", err), true
|
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 {
|
if err = c.Hello(fromDomain); err != nil {
|
||||||
return tr.Errorf("Error saying hello: %v", err), false
|
return tr.Errorf("Error saying hello: %v", err), false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user