by Ephrones:
Dial() wants as addr a scheme as defined in http://golang.org/pkg/net/#Dial.
SendMail() calls Dial() internally, but without looking at its source one can only guess
from the docstring what scheme it needs as addr.
It gets fun when you create a PlainAuth(), which wants a host (that is basically addr
but without the colon separated port). I thought: “Ah, already got that!” and put in
my addr from before. Now you get a rather meaningless “wrong host name” error.
As it turns out this one is thrown in net/smtp/auth.go because host doesn’t like the
port.
imho Dial() should have host and port as separate arguments, but I see that the API
can’t be changed now.
So I suggest the following:
1. Clarify the docstrings (reference to Dial() in net in all Dial() docstrings and in
SendMail)
2. Improve “wrong host name” to Sprintf("wrong host name (%s)", hostname)
Pull request coming, will reference this issue.
by Ephrones: