Trying to use Expect Script the Active TCL in Windows to send an email out every it is run. Below is the code I have but there is an error message displayed below and would appreciate any help on how to avoid the problem. Thank you.
#!/usr/bin/expect
#
exec tclsh "$0" ${1+"$@"}
package require Expect
spawn plink -telnet IP PORT
send "ehlo *******.com
";
send "AUTH LOGIN
";
expect "334 VXNlcm5hbWU6" sleep .1;
send "*************
";
sleep .1;
expect "334 UGFzc3dvcmQ6
"
send "********
";
sleep .1;
expect "235 Authentication succeeded
";
send "MAIL from:******@*******.com
";
expect "250 OK
"
send "RCPT to:********@*********.com
";
expect "250 Accepted
"
send "DATA
";
send "!!!TEXT HERE!!!
";
send ".
";
send "QUIT
";
exit
Getting a error:
Error in startup script
send: spawn id exp2 not open
while executing
"send "MAIL from:*****@******.com
""
(file "***.tcl" line 16)
Any ideas on what is wrong here????
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…