0

Manually, I can do the following from Windows CMD,

telnet smtp.server 25
MAIL FROM:<Test@domain.com>
RCPT TO:<Test2@domain.com>
data
message
.
quit

And It's working Normally but I am trying to automate this via windows batching, IT's easy to do this via shell Scripting on Linux, But in windows batching I found many troubles to make this kind of interactive scripts.

Do you've Suggestions ?

user212051
  • 93
  • 1
  • 2
  • 11

2 Answers2

0

You may directly store your lines above in a text file (not a Batch one) and then use an interesting trick in order to execute them:

cmd < theFile.txt

Previous line open a cmd.exe session that get its input from the given file instead of the keyboard. You may read further details about this method at this post.

Community
  • 1
  • 1
Aacini
  • 65,180
  • 12
  • 72
  • 108
  • This means that `telnet` program does not read its input from Stdin in the usual way. Bad luck... :/ – Aacini Mar 25 '15 at 16:10
0

As it turns out, the Windows telnet utility cannot be scripted. There are solutions, but they're ugly. See https://serverfault.com/questions/41919/can-the-windows-telnet-client-be-scripted.

Community
  • 1
  • 1
bgoldst
  • 34,190
  • 6
  • 38
  • 64