I think because the remote host closed the connection and plink exited.
Why don't you use the smtp
package of tcllib?
It is much easier to use than talking raw smtp over plink with expect.
To summarize: you use plink for telnet, a thing that you can do with tcl socket
s already.
You talk smtp, something where many libs exists that makes using it much easier.
Example of sending mail with pure tcl:
package require mime
package require smtp
set tok [::mime::initialize
-canonical text/plain
-header {From sender@address.example.com}
-string {Some Text Here}]
::smtp::sendmessage $tok
-servers IP
-ports PORT
-username ******
-password ******
-recipients recipient@address.example.com
-originator sender@address.example.com
::mime::finalize $tok
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…