Discussion Locked

Telnet Scripting

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Is it possible to write a script inside a telnet session port 25. I wrote a script that executes all telnet sendmail commands, but would like to include the script as part of the stationery.

5 replies

by dbs

There are many ways. Here's a test script I use.

if [ ! -p mailin ] ; then
mknod mailin p
fi

# /usr/lib/ppp/chat -v "ESMTP spoken here" helo "to meet you" "mail from: dbs"
ok "rcpt to: dbs" itself "this is a test" "" "." delivery "quit" < mailin | teln
et localhost 25 | mailin

ME=$$

(sleep 10 ; kill -14 $ME ) &

trap "" 14
( while : ; do
read X
echo $X >&2
read X
echo $X >&2
read X
echo $X >&2
read X
echo $X >&2
echo "helo"
read X
echo $X >&2
echo "mail from: dbs"
read X
echo $X >&2
echo "rcpt to: dbs"
read X
echo $X >&2
echo data
read X
echo $X >&2
echo This is a test
echo "."
read X
echo $X >&2
echo quit
done) < mailin | telnet localhost 25 > mailin

This discussion is closed to new replies.