I have the following working fine from the command line:

telnet (my email smtp) 25
helo
mail from:(my email address)
rcpt to:(my email address)
DATA
SUBJECT:(my subject)
(my message)
.

This is sending me an email. My problem is that I need to emulate all of this from either a c++ file or a batch file. How can I pass instructions to telnet from a batch file?

Sorry for the double post. I would just like to add that I have indeed tried this:

(echo helo; echo "mail from:(my email address)"; echo "rcpt to:(my email address)"; echo DATA; echo SUBJECT:(my subject); echo "(my message)";echo .)|telnet (My email smtp) 25

And it failed :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.