sending email from my c++ application

Started by
1 comment, last by hplus0603 19 years, 1 month ago
Does anyone know how to send an email message from a c++ application? ive learned that I will need to interface with an SMTP server in order to send email. I want my application to report the user's usage of the application, and have that data sent to myself via email.
Advertisement
(Moved to networking forum)

RFC 821
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
The easiest way is to use the mail API on Windows (which will go through Outlook or Outlook Express, most likey), and to stick the message in a file in /tmp and call system("sendmail ...args...") on UNIX.

If you want to connect directly to a mail server, google for RFC 821, which contains the basic SMTP protocol. You open a SOCK_STREAM (TCP) connection to the server, and do a simple, text-based "chat" dialog to send the message.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement