Simple SMTP Batch Script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
deibertine
Posts: 6
Joined: 19 Aug 2010 21:44

Simple SMTP Batch Script

#1 Post by deibertine » 18 Jan 2011 12:23

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 :|

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Simple SMTP Batch Script

#2 Post by aGerman » 18 Jan 2011 13:03

No idea. Did you ever try blat?

Regards
aGerman

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

Re: Simple SMTP Batch Script

#3 Post by ghostmachine4 » 18 Jan 2011 20:07

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.

amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

Re: Simple SMTP Batch Script

#4 Post by amel27 » 19 Jan 2011 03:38

deibertine, You can use Plink, a command-line tool which comes with PuTTY, to automate Telnet sessions

deibertine
Posts: 6
Joined: 19 Aug 2010 21:44

Re: Simple SMTP Batch Script

#5 Post by deibertine » 20 Jan 2011 15:55

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

Post Reply