Send text file to mail

I have a utility that opens a telnet session and allows me to execute commands through a script. The utility allows me to output to a text file whatever is outputted to screen.
This utility runs from a DOS prompt in Windows 95/98, NT or 2000. How can I mail text file this to a certain user.

I telnetted to port 25 of the mail server ( exchange server) and tried to manipulate the file. But the commands only seem to allow for emailing a string of data.

e.g. telnet
helo user
This is the string that I am sending

Note that after the string, one must type <CR>.<CR>
Does anyone know if sending a file instead of a string is possible ?

I have no idea how this works with Exchange but on a UNIX box you can mail a file named textfile to like this;
cat textfile | /usr/lib/sendmail -v

The -v (verbose) is optional, it shows you what it is doing.

When you telnet to an SMTP listening process you can tranfer files only by sending the entire file content into the telnet stream (like piping the data into the telnet process after the data command, etc.) There is no command like FTP to do this using hand command (telnet)into the SMTP protocol.

If you want to do this using hand command, you can try cutting and pasting the file contents (if the file is not too big :slight_smile: ) in your telnet session. If you write a script, you can pipe a files content (encoded, not binary) in to the telnet session. There are two or three threads in the board-knowledge-base which demo this for other examples.