TELNET, bat file - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

TELNET, bat file

christophevachristopheva Posts: 14Member
[b][red]This message was edited by christopheva at 2006-6-7 15:44:9[/red][/b][hr]
I am trying to make a mail program with BAT:

@echo off
telnet 192.168.1.103 25
mail from:*****@********.com
rcpt to: ***@*******.com
data
test.
.

This is my BAT file. But it doesnt work :( .
When I type all this my self in ms-dos executor, it works.

Comments

  • rollerolle Posts: 114Member
    : I am trying to make a mail program with BAT:
    :
    : @echo off
    : telnet 192.168.1.103 25
    : mail from:*****@********.com
    : rcpt to: ***@*******.com
    : data
    : test.
    : .
    :
    : This is my BAT file. But it doesnt work :( .
    : When I type all this my self in ms-dos executor, it works.
    :
    : I hope you can understand my problem...
    :
    :
    [green]When you type in from cmdline, telnet gets its input from the kbd (and shows the result on display). But to be able to use it from a bat file, you have to redirect input. Try this:

    * Create a file with the commands you want to give to telnet, like
    mail from:*****@********.com
    rcpt to: ***@*******.com
    data
    test.
    .

    * Then have the bat file look something like
    @echo off
    telnet 192.168.1.103 25 < infile

    Where infile is the name of the file you created. It's the "<" that makes redirection of input. In the same manner you can redircet output to a file by making the telnet line the following:
    telnet 192.168.1.103 25 < infile > outfile[/green]
  • christophevachristopheva Posts: 14Member
    [b][red]This message was edited by christopheva at 2004-9-3 10:12:26[/red][/b][hr]
    Thank u SO much for the reply!
    But it doesn't works...
    This is what I made:


    "MAIL.bat"
    @echo off
    telnet 192.168.1.103 25 < CMD.txt

    "CMD.txt"
    helo cva
    mail from: ...
    rcpt to: ...
    data
    test.
    .


    I hope u can help me out...
  • tarkeshtarkesh Posts: 1Member
    : [b][red]This message was edited by christopheva at 2004-9-3
    : 10:12:26[/red][/b][hr]
    : Thank u SO much for the reply!
    : But it doesn't works...
    : This is what I made:
    :
    :
    : "MAIL.bat"
    : @echo off
    : telnet 192.168.1.103 25 < CMD.txt
    :
    : "CMD.txt"
    : helo cva
    : mail from: ...
    : rcpt to: ...
    : data
    : test.
    : .
    :
    :
    : I hope u can help me out...
    :


    I HAVE the exact same problem.
    I hope u got the solution. could you please share it.

    thanks,.
    Tarkesh
Sign In or Register to comment.