mail (smtp) using telnet batch script

By jori
Sep 30, 2005
  1. Hello,

    I'm have to find/make something to test a list of +- 40 servers (on different locations) on mail relay. My idea was to make a little batch script that tries to send a mail (to myself) using telnet (telnet <server name> 25, helo etc, etc.).

    Now my problem is that i can't find a way to let him check a different server everytime.
    So my first question is: is there a way to do this, or do i need to copy/paste the same steps (telnet <server> 25, helo etc, etc) 40 times and change the server name everytime?

    second question is: can i delay the input of my batch file? 'cos otherwise the server doesn't get all the commands 'cos the input is faster than he can handle it.

    tnx in advance,

    found a way to delay things (call in another batch scripts that uses ping -w)
  2. PatrickMc

    PatrickMc TS Rookie

    Argument passing to batch script

    You can use biterscripting for passing different server to the script each time.

    You script may have something like this.

    # Script TestServer
    var str server
    telnet $server
    # End of script
    You save this script in file C:\Scipts\TestServer.txt.

    Then call this script as follows.

    script TestServer.txt server("server1")
    script TestServer.txt server("server2")
    You can even put a list of servers in a file, and call the script for one server at a time automatically. What's best is that you can parse the output using biterscripting editors to automate server state checking also.

    biterscripting ( is free scripting language. It seems to offer a bit more flexibility than batch. If you install it, make sure you follow the installation instructions posted at their web site.

  3. jobeard

    jobeard TS Ambassador Posts: 9,156   +598

    SMTP is FAR MORE than just a connection; If your goal is to show that the
    server is accepting connections, then the telnet servername 25 is sufficient.
    Otherwise you need to master the protocol.

    Perl and PHP have prepackaged modules which will manage the protocol and
    your scripts provide Server Name, Sendto: Subject: and Body text.
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...