Отправка электронной почты с помощью expect

Описание команды expect в этой Wiki

sendemail.sh
#!/usr/bin/expect
set timeout -1
spawn telnet mx.mydomain.ru 25
send "ehlo mysmtpserver.ru\r"
expect "250-8BITMIME"
send "MAIL FROM:<info@mysmtpdomain.ru>\r"
expect "250"
#expect "250 2.1.0 Ok"
send "RCPT TO:<info@mydomain.ru>\r"
expect "250"
#expect "250 2.1.5 Ok"
send "data\r"
expect "354 End data with <CR><LF>.<CR><LF>"
send "Test message\r"
send ".\r"
expect "Ok"
send "quit\r"