Telnet SMTP with expect or shell script
Posted
by
Fendrix
on Stack Overflow
See other posts from Stack Overflow
or by Fendrix
Published on 2012-09-07T14:58:24Z
Indexed on
2012/09/07
15:38 UTC
Read the original article
Hit count: 272
Want to build up a Auth Smtp Connection with expect script... just to test I wanted to get ehlo parameters but expect is not working like this
#!/usr/bin/expect
set timeout -1
set smtp [lindex $argv 0]
set port [lindex $argv 1]
spawn telnet $smtp $port
expect "[2]{2,}[0]{1,}"
send "ehlo"
I expect the code 220 to come from mailserver to continue to send ehlo ... just like
..../...:telnet smtp.mail.yahoo.de 25
Trying 77.238.184.85...
Connected to smtp2-de.mail.vip.ukl.yahoo.com.
Escape character is '^]'.
220 smtp116.mail.ukl.yahoo.com ESMTP
ehlo
250-smtp116.mail.ukl.yahoo.com
250-AUTH LOGIN PLAIN XYMCOOKIE
250-PIPELINING
250-SIZE 41697280
250 8BITMIME
© Stack Overflow or respective owner