Dim tempShell As New Shell
tempShell.TimeOut = -1
tempShell.Execute("telnet mx2.mail.icloud.com 25 ;helo")
It seems to close the telnet connection before the ‘help’ command can begin, with the shell Result:
[quote]Trying 17.172.34.12…
Connected to mx2.mail.icloud.com.
Escape character is ‘^]’.
Connection closed by foreign host.[/quote]
I have tried placing the ‘helo’ shell command on the same line (as above) or on two, but the result is the same I get logged out. It works if I open a Terminal window and enter the same commands. Is there a problem with telnetting from within a shell?
This problem occurs with my Outlook.com and host mail exchanges too.
I admit, I have not read through all the links you shared above, but I wonder: why not just use a socket? Telnet is not a particularly special protocol… all you appear to be trying to do is connect to port 25, send the helo command, and wait for a response. A standard socket should have no problem with this at all… Is there some specific reason you are going through the trouble of using a terminal for this?
I’ve tried a polling timer, displaying all connection results and a button to send the ‘helo’ command, but still to results from the helo. My changes are in a revised version:
How odd. I’m trying it against my own mail server and getting the same situation: The initial greeting is received, but nothing thereafter. My server’s logs indicate that the socket is disconnecting… I’m trying to figure out why.
Have you tried any other mail servers? It is working just fine with my own mail server, though I have to use port 587 because it does not accept port 25 smtp requests unless you pass a bunch of security stuff as a validated sending mail server.
I note that the tutorial you are following is from back in 2009, when email was more of a wild west than it is now… in recent years servers have gotten a lot more security-conscious, and are much more persnickety about what they let connect and talk to them.
However, I also note that an interactive telnet session in the terminal works with the server you have listed at icloud.com… there are some differences between Telnet and straight TCP socket communication, but at the core SMTP is performed by following the specs in the latest RFC, which a generic TCP socket should be able to do with no problems.
At this point I’d pull out a packet sniffer and inspect the packets that are being sent by the telnet client and compare those to the packets being sent by your socket. I like CocoaPacketAnalyzer for doing this sort of thing, but WireShark is the big name and most capable.