At least I assume this is a documentation issue, but I suppose it could also be solved by implementing what is documented.
What version of Go are you using (go version)?
$ go version
go version go1.16.3 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/joe/.cache/go-build"
GOENV="/home/joe/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/joe/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/joe/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/joe/sdk/go1.16.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/joe/sdk/go1.16.3/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/joe/git/EgilAdmin/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3044481225=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Tried to send email with smtp.SendMail, with authentication disabled in the way suggested in the documentation for smtp.Auth.
Documentation for the Start function in the smtp.Auth interface states:
It can return proto == "" to indicate that the authentication should be skipped.
So I implemented a noAuth type like this:
type noAuth struct {
}
func (a *noAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
return "", nil, nil
}
func (a *noAuth) Next(fromServer []byte, more bool) ([]byte, error) {
return nil, nil
}
This doesn't seem to work, but by skipping this and just sending nil as Auth to smtp.SendMail() it works fine.
The documentation for smtp.SendMail does say that the Auth parameter is optional, but it seems the comment in the Auth interface about returning "" should be removed.
smtp.SendMail seems to only check for nil, and the Auth method for smtp.Client also doesn't care whether an empty mech is returned.
What did you expect to see?
Successfully sent email.
What did you see instead?
SMTP server replies 504 5.7.4 Unrecognized authentication type
At least I assume this is a documentation issue, but I suppose it could also be solved by implementing what is documented.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Tried to send email with smtp.SendMail, with authentication disabled in the way suggested in the documentation for smtp.Auth.
Documentation for the Start function in the smtp.Auth interface states:
So I implemented a noAuth type like this:
This doesn't seem to work, but by skipping this and just sending nil as Auth to smtp.SendMail() it works fine.
The documentation for smtp.SendMail does say that the Auth parameter is optional, but it seems the comment in the Auth interface about returning "" should be removed.
smtp.SendMail seems to only check for nil, and the Auth method for smtp.Client also doesn't care whether an empty mech is returned.
What did you expect to see?
Successfully sent email.
What did you see instead?
SMTP server replies
504 5.7.4 Unrecognized authentication type