You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
net/smtp always uses localhost with helo command, and since localname in not exported in Client struct, you can't change it not to use localhost. Here you can find Client struct inside net/smtp/smtp.go :
// A Client represents a client connection to an SMTP server.
type Client struct {
// Text is the textproto.Conn used by the Client. It is exported to allow for
// clients to add extensions.
Text *textproto.Conn
// keep a reference to the connection so it can be used to create a TLS
// connection later
conn net.Conn
// whether the Client is using TLS
tls bool
serverName string
// map of supported extensions
ext map[string]string
// supported auth mechanisms
auth []string
localName string // the name to use in HELO/EHLO
didHello bool // whether we've said HELO/EHLO
helloError error // the error from the hello
}
This way it's not possible to start smtp with any other mail server not running on localhost.
The text was updated successfully, but these errors were encountered:
MBakhshi96
changed the title
net/smtp: No way to use other host name than localhost with helo command in smtp
net/smtp: No way to use other host name than "localhost" with helo command in smtp
Aug 13, 2019
Hello sends a HELO or EHLO to the server as the given host name. Calling this method is only necessary if the client needs control over the host name used. The client will introduce itself as "localhost" automatically otherwise. If Hello is called, it must be called before any of the other methods.
net/smtp always uses localhost with helo command, and since localname in not exported in Client struct, you can't change it not to use localhost. Here you can find Client struct inside net/smtp/smtp.go :
This way it's not possible to start smtp with any other mail server not running on localhost.
The text was updated successfully, but these errors were encountered: