sending mails with popen/telnet

jurij used Ask the Experts™
I want to send emails from a c++ console app using ppoen and telnet.. what am I doing wrong?
My code:
 FILE *fp=popen("/bin/telnet 25","w");
 fprintf(fp,"MAIL From:\n");
 fprintf(fp,"RCPT To:\n");
 fprintf(fp,"BLA BLA BLA :) \n");

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


I do not have C knowlegde.

But, some note:  HELO is followed by your hostname and not the remote SMTP.  In most cases, it should be ok.

Another, how about using from\ instead of

just a thought.


Actualy I send server's virual addres, that my domain points to - something like - but you're probably right - anyway it works if I do it on my own - i just copied the lines I used when telneting to the server.
I think the problem is somewhere else - telnet is like a two way stream, but i can just write or read - or am I mistaking?
What is the difference beetwen from\ and

in some language, PERL for example @ will denote array type variable.  Not sure about C, so if we really want the string @something, then using @something will be a reference to an array with label something, so \@something will actuall mean @someting (gee.. confusing).

anyway, I would think that you are on the right track about the "stream".  yes telnet do establist a two-way data stream (need to reconfirm this with some socket programmer).



I decided to send emails a different way(using telnet from my program)..
Tnx for all the help!

you're welcome.

happy holidays.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial