使用expect自动发送邮件的脚本

#!/usr//bin/expect
spawn telnet mail.domain.com 25
expect "220"
send "ehlo mail.domain.com "
expect "HELP"
send "auth login "
expect "334"
send "邮件用户名(base64编码) "
expect "334"
send "密码(base64编码) "
expect "235"
send "mail from:dominic.zhang@domain.com "
expect "250"
send "rcpt to:jack@domain.com "
expect "250"
send "data From: dominic.zhang@domain.com To: jack@domain.com Date: Subject: test mail HI,test dominic's test . "
expect "250"
send "quit "