I have the following working fine from the command line:

telnet (my email smtp) 25
mail from:(my email address)
rcpt to:(my email address)
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 learning and sharing knowledge.