Page 1 of 1

Simple SMTP Batch Script

Posted: 18 Jan 2011 12:23
by deibertine
Hi there,
I'm trying to write a simple smtp batch script that will test relays in our multiple servers.

Here's the script looks like:

telnet 10.144.134.125 25
sleep 1
echo "helo localhost"
sleep 1
echo "mail from:admin_net@postteam.com"
sleep 1
echo "rcpt to: dei_bertine@post.com"
sleep 1
echo "data"
sleep 1
echo "subject:Test message from web01 srv1"
sleep 1
echo "Hello there!"
sleep 1
echo "."
sleep 1
echo "QUIT" << END_SCRIPT

Here's the problem:
When I initiate this script, it hangs after "telnet 10.144.134.125 25" then just sits there and script doesnt proceed...

Is there a some sort of "switch" parameter that I need to add after "telnet 10.144.134.125 25?"

Any help is appreciate mates!

DB :|

Re: Simple SMTP Batch Script

Posted: 18 Jan 2011 13:03
by aGerman
No idea. Did you ever try blat?

Regards
aGerman

Re: Simple SMTP Batch Script

Posted: 18 Jan 2011 20:07
by ghostmachine4
the windows telnet client is not suited for scripting. Simple as that. Use an email client like blat as suggested. Or you could use a programming language with socket programming.

Re: Simple SMTP Batch Script

Posted: 19 Jan 2011 03:38
by amel27
deibertine, You can use Plink, a command-line tool which comes with PuTTY, to automate Telnet sessions

Re: Simple SMTP Batch Script

Posted: 20 Jan 2011 15:55
by deibertine
I think I will lean towards plink as suggested, seems to be the best match the goal I am trying to achieve.

Thanks to all who posted, really appreciate it! :D