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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user