Reputation: 5508
I'm making a program that supports email functionality within a web browser. I want it to be able to email people and I'm trying to find out how I can accomplish this using C++. Could someone please help?
Upvotes: 1
Views: 3785
Reputation: 12547
I've tried sending email with CURL and with libesmtp.
Both are good, although I like CURL more because it can work asynchronously.
Also, I have a header-only curl wrapper. Sending email with it is as simple as:
long rc = Curl().send ("Subject: subject\r\n\r\n" "text\r\n") .smtp ("from", "to") .go().status();
if (rc != 250) std::cerr << "Error sending email: " << rc << std::endl;
Upvotes: 0
Reputation: 61
Sockets are your best bet. Your best resource for sockets in C and C++ is: http://beej.us/guide/bgnet/
For an implementation try here: http://www.codeguru.com/forum/showthread.php?t=300530
Upvotes: 0
Reputation: 4887
If you are on Windows, I have used Dundas Ultimate TCP/IP with great results.
Upvotes: 0
Reputation: 112366
If all else fails, you could always write the mail to a file and try using system(3) to invoke mail(1).
$ mail -s 'OMG!' [email protected] < mymailfile
Upvotes: 0
Reputation: 2696
All you have to do is use a library that lets you use an SMTP server (Simple mail transfer protocol). What platform are you developing this for?
Upvotes: 0