hi Tim,
On Sun, 1 Dec 2019, tim Rowledge wrote:
An oddity spotted and possibly a bug at some level - when connecting to an SMTP server we use #ensureConnection, which uses #login, which sends #initiateSession. But the SMTPClient class>>openOnHost:port: over-rides the ProtocolClient class>>openOnHost:port: and adds another #initiateSession.
I'm pretty sure that SMTPClient class>>openOnHost:port: can simply be removed but it's late on a sunday and reading RFCs has mangled too many braincells. I guess that sending the SMTP server 'EHLO' twice won't cause too many explosions in data centres but it may be a bit rude and certainly wastes network traffic. Does anyone have a strong attachment to double-initialising the connection?
The class-side method is indeed flawed and unnecessary. It should be removed.
I think it would also be useful to add a utility mail sending method that takes a user name and password for those servers wanting them.
Lastly, the EHLO command wants that awkward local host name, just like SqueakSource does. Levente's suggestion of fudging it to 127.0.0.1 for smtp seems to work ok but it probably isn't bullet-proof. We sure could do with a decently reliable way to get a suitable value.
You must specify the name yourself. There is no way to find out the FQDN of your outgoing IP address from your machine without the help of an external host, but that is what should be sent in the first place. 127.0.0.1 works, because the RFC allows it, and because of the above: an internal host cannot know its FQDN.
If your machine had a network interface configured with a global IP address, then the primLocalAddress could return it to your image. But nowadays most machines are behind a NAT, so your machine is very unlikely to have such address. And even if your machine had such address, your network interface would have to be called eth0 or wlan0 on linux, because those names are hardcoded into the VM. On my machine, no such interface exists, so the primitive always returns 0.0.0.0. That's another bug to be fixed.
Levente
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: MC: Melt down Core