tags:

views:

370

answers:

5

Hello all i need to add the ability in my application to send emails ( with the user's email server/service ) for that i need to wirth or to use smtp c++ lib or code in which i have no idea where to find . where can i find free lib or source code that i can use or learn from .
can you please help me on this subject Thanks

A: 

If you don't mind a GPL license you can try VMime

and if you want the library for windows you can try CPJNSMTPConnection

Aragorn
+1  A: 

Under Unix, the normal way of sending a mail from a program is piping its contain (with popen) to /usr/lib/sendmail. The other MTAs (postfix and so on) provide a compatibility program with that interface.

The advantage is that you don't have to configure each program sending mail so that they are using the right gateway, able to use aliases, ...

AProgrammer
+1  A: 

Use boost::asio and follow the protocol specs to write a simple client.

navigator
to much time for that .. i relay need cross platform lib , by the way isnt its just protocol so the code can be one for each OS..no?
+4  A: 

I would suggest using poco c++ libraries. These are resleased under Boost Software License (one of the most non-restrictive open source licenses) and they feature Mail-lib as part of it. This is what their doc states:

Classes for sending e-mail messages via SMTP (Simple Mail Transfer Protocol, RFC 2821) servers with support for e-mail attachments, as well as classes for downloading e-mail messages from POP3 (Post Office Protocol Version 3, RFC 1939) servers.

Poco Website

Regards,
Ovanes

P.S. Poco C++ Libs is a multi-platform framework.

ovanes
A: 

Depending on your requirements ACE might be an option. It's a free open-source framework which is available for a lot of operating systems.

I don't know if they have a concrete implementation for smtp but at least they provide C++ abstractions for the connectivity part. So only the protocol implementation is up to you.

caahab