#!/usr/bin/expect
set smtp [lindex $argv 0]
set from [lindex $argv 1]
set to [lindex $argv 2]
set title [lindex $argv 3]
set content [lindex $argv 4]
spawn telnet $smtp 25
expect "220"
send "HELO 主机名\r"
expect "250 OK"
send "MAIL FROM: <$from>\r"
expect "250 Mail OK"
send "RCPT TO: <$to>\r"
expect "250 Mail OK"
send "DATA\r"
expect "354"
send "TO: $to\r"
send "FROM: $from\r"
send "SUBJECT: $title\r"
send "\r"
send "$content\r"
send ".\r"
expect "250"
send "QUIT"
阅读(1044) | 评论(0) | 转发(0) |