MS-DOS

Moderators: blip
Number of threads: 362
Number of posts: 872

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
TELNET, bat file Posted by christopheva on 27 Aug 2004 at 7:12 AM
This message was edited by christopheva at 2006-6-7 15:44:9

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.
Report
Re: TELNET, bat file Posted by rolle on 2 Sept 2004 at 12:05 PM
: 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...
:
:
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

Report
Re: TELNET, bat file Posted by christopheva on 3 Sept 2004 at 7:59 AM
This message was edited by christopheva at 2004-9-3 10:12:26

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...
Report
Re: TELNET, bat file Posted by tarkesh on 4 Sept 2008 at 3:42 PM
: This message was edited by christopheva at 2004-9-3
: 10:12:26


: 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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.