mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-18 12:09:30 +00:00
Chore: Use local hostname for EHLO/HELO in SMTP communication
This commit is contained in:
@@ -90,7 +90,13 @@ func sendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
|
||||
}
|
||||
defer func() { _ = c.Close() }()
|
||||
|
||||
if err = c.Hello(addr); err != nil {
|
||||
// Use the local hostname for EHLO/HELO as required by RFC 5321.
|
||||
// Fall back to "localhost" if the hostname cannot be determined.
|
||||
localHostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
localHostname = "localhost"
|
||||
}
|
||||
if err = c.Hello(localHostname); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user