Follow up, while /sockopen -t worked for me with an irc server, the original topic at hand was to be able to send an email using outlook smtp server (which does not support SSL directly, only STARTTLS, yeah don't ask me why).

When I try though, the smtp server close the connection pretty much as soon as I execute /sockopen -t

Start the connection with //sockopen sendmail smtp.office365.com 587
on *:sockclose:sendmail:echo -sg socket closed sockclose
on *:sockopen:sendmail:if ($sockerr) echo -sg sockerr in sockopen $sock($sockname).wsmsg
on *:sockread:sendmail:{
if ($sockerr) {
echo -sg socker error in sockread $sock($sockname).wsmsg
return
}
var %temptext
sockread %temptext
if (!$sockbr) return
tokenize 32 %temptext
echo -stg ?? $1-
}



Originally Posted by SMTP
> //sockopen sendmail smtp.office365.com 587
[04:17:52] ?? 220 LO4P123CA0604.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 24 Apr 2023 02:17:51 +0000
> //sockwrite -n sendmail EHLO
[04:17:55] ?? 250-LO4P123CA0604.outlook.office365.com Hello [2a01:cb04:bc:be00:7d67:cbe8:9da0:a279]
[04:17:55] ?? 250-SIZE 157286400
[04:17:55] ?? 250-PIPELINING
[04:17:55] ?? 250-DSN
[04:17:55] ?? 250-ENHANCEDSTATUSCODES
[04:17:55] ?? 250-STARTTLS
[04:17:55] ?? 250-8BITMIME
[04:17:55] ?? 250-BINARYMIME
[04:17:55] ?? 250-CHUNKING
[04:17:55] ?? 250 SMTPUTF8
> //sockwrite -n sendmail STARTTLS
[04:18:21] ?? 220 2.0.0 SMTP server ready
> //sockopen -t sendmail
socket closed sockclose

I believe mIRC is doing the correct job and that the smtp server is broken, but I have no idea. But yeah, trying with IRC, when you tell the IRC server that you want to use STARTTLS, the raw 670 reply is very clear that you need to initiate the handshake and only then the server starts the process again (second Looking up your hostname) whereas the smtp server reinitialize the process before I use /sockopen -t:

Originally Posted by IRC
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** Looking up your hostname...
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** Found your hostname (cached)
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** Checking ident...
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** No ident response; username prefixed with ~
> sending starttls
?? :tardis.en.uk.SwiftIRC.net 670 * :STARTTLS successful, go ahead with TLS handshake
> executing sockopen -t
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** Looking up your hostname...
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** Checking ident...
?? :tardis.en.uk.SwiftIRC.net NOTICE * :*** No ident response; username prefixed with ~
> sending nick vimse
?? PING :D8C6C227
> sending USER Ouims 0 * :.
> sending pong D8C6C227
?? :tardis.en.uk.SwiftIRC.net 001 vimse :Welcome to the SwiftIRC IRC Network vimse!~Ouims@whatever
?? :tardis.en.uk.SwiftIRC.net NOTICE vimse :*** Your TLS certificate fingerprint is whatever
?? :vimse MODE vimse :+ixz


#mircscripting @ irc.swiftirc.net == the best mIRC help channel