Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

telnet commands with .bat

322 views
Skip to first unread message

Glenn Venzke

unread,
Feb 24, 2004, 12:39:06 AM2/24/04
to
I am a newbie, so please forgive my ignorance. I have written code to send
email via telnet. It works perfectly when done via command prompt. When I
try to run it from a .bat, it fires up telnet with no problem but any
commands I try to send it after that result in errors. I assume this is
because .bat is used for DOS commands so once telnet is running, I'm talking
to it and not DOS. Is there any way to send commands of this type via .bat?

telnet servername 25
REM it gets this far and then bombs out. I need to execute the following
lines

hello mymachine
mail from: m...@email.com
rcpt to: yo...@email.com

etc..
--

Thanks!

Glenn Venzke
(630)455-1434
gve...@worldnet.att.net


Matthias Tacke

unread,
Feb 24, 2004, 6:35:13 AM2/24/04
to
"Glenn Venzke" wrote:

Hello Glen,
you presumably use a windows version. Then I'd use blat for sending mail
http://www.blat.net/
For reading mails from the commandline there is,IIRC not free, Mailgrab.

HTH

--
Greetings
Matthias

Ted Davis

unread,
Feb 24, 2004, 9:24:43 AM2/24/04
to
On Tue, 24 Feb 2004 05:39:06 GMT, "Glenn Venzke"
<gve...@worldnet.att.net> wrote:

>I am a newbie, so please forgive my ignorance. I have written code to send
>email via telnet. It works perfectly when done via command prompt. When I
>try to run it from a .bat, it fires up telnet with no problem but any
>commands I try to send it after that result in errors. I assume this is
>because .bat is used for DOS commands so once telnet is running, I'm talking
>to it and not DOS. Is there any way to send commands of this type via .bat?
>
>telnet servername 25
>REM it gets this far and then bombs out. I need to execute the following
>lines
>
>hello mymachine
>mail from: m...@email.com
>rcpt to: yo...@email.com

Since only the command processor can execute a batch file, and the
telnet client is an application, the batch file launches it as an
application, then has nothing more to do with it. You are actually
trying to script a telnet session, and this is done by putting the
commands, including the exit command in a script file and either
redirecting the file to the client or passing it as a command line
argument. Or rather this would be done if the telnet client could be
scripted - if you find one that can, please let us know.

netcat can be scripted, and can be used to emulate a telnet client,
but you are probably either trying to send mail, in which case a
mailer program such as BLAT (for Windows) would be preferred, or you
are trying to script telnet and e-mail is just incidental - in that
case you are wasting your time and effort.

T.E.D. (tda...@gearbox.maem.umr.edu)
SPAM filter: Messages to this address *must* contain "T.E.D."
somewhere in the body or they will be automatically rejected.

ShoeLeatherExpress

unread,
Mar 2, 2004, 7:20:38 AM3/2/04
to
On Tue, 24 Feb 2004, "Glenn Venzke"
smoked my sorry cornpewter with this blazing revelation:

I use NetCat to send email and post to the NGs. I don't use a batch
file, I simply embed the commands in the message to be sent:

helo smtpserver
mail from: myemail@popserver
rcpt to: myfr...@timbuctu.net
data
To: My Friend <myfr...@timbuctu.net>
From: ShoeLeatherExpress <myemail@popserver>
RestOfHeaders:

Message Body
.
quit

Then I send it with the command "nc smtpserver 25 < messagefile.txt".

When I post to the newsgroups, it's a bit simpler:

authinfo user username
authinfo pass password
post
Headers:

Message Body
.
quit

Then I send with "nc newsserver 119 < messagefile.txt".

The "authinfo" part is left off on servers not requiring
authorization.

HTH

--
,,^ ..^,, (<(((><)ShoeLeath...@BigFoot.Com(><)))>) ,,^.. ^,,
"There is a simple, straight-forward solution to this mess."
"Any clues as to what that might be?"

0 new messages