telnet自动邮件脚本
时间:2010-08-03 来源:night85
#!/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"
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"
相关阅读 更多 +