telnet shell script on red hat 9 cmd line only

i would like to make a shell script (red hat 9 cmd line only)
to telnet to my local isp's webmail server on port 25 and send it commands
such as helo :slight_smile: help would be much appreciated, and i found no posts similar that answered my question... the closest i've gotten to an answer from about 8 google searches is :
CODE:
#/usr/bash
( echo "helo" ) | telnet /*webserver*/ /*port*/ ;
CODE:
this code did not seem to do the job :frowning: sadly...

i could manage in c++ possibly.. with some guidance but i'm trying to learn some shell programming, i've also given up on trying to do this with a doskey macro or a batch file on windows..
would someone please help me?
i'm using red hat 9 cmd line only (no gui package installed)

BTW: batch file code to do this would be awesome

The reason why you can't find many posts on this is probably because it's a common tactic that spammers use, and the fact you mention that "batch file code would be awesome" suggests your intentions is to use your ISP mail server as a spam relay or to spoof e-mails.

Sadly you won't get any help here!

i should have lied about my intentions like the other posts i saw on the internet....

Remember "horses for courses", the SMTP protocol used between servers on port 25 is a protocol that requires responses based on logic and state. Shell script is not the language for trying to do this in this situation. You would have better success with C, C++, Java, Perl or Python.

SMTP is an open protocol and you are welcome to use it, as all mail-transfer-agents do.

Also, consider why are you trying to re-invent the wheel, projects such as postfix do an excellent job of managing SMTP both outgoing and incoming in a very flexible manner, allowing you to concentrate on what you are trying to do rather than the nitty-gritties of the SMTP protocol.