Skip to content

Otsoko/Email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email

Send email in C++ implementing the SMTP protocol.

How to use

Email *email = Email::Instance();
std::vector<std::string> recipients;
recipients.push_back("recipient1@server.com");
recipients.push_back("recipient2@server.com");

int ret = email->sendmail(
    "from@server.com",                               /* from     */
    recipients,                                      /* to       */
    "Mail subject",                                  /* subject  */
    "Mail body.\n\nCan contain linebreaks.\n\nBye.", /* body     */
    "localhost",                                     /* hostname */
    25                                               /* port     */
);

if (ret != 0)
    std::cerr << "Failed to send mail (code: " << ret << ")" << std::endl;
else
    std::cout << "Mail successfully sent" << std::endl;

email->Release();

Build

To build this project run

$ mkdir build
$ cd build
$ cmake ..
$ make

Run

To run this project run

$ ./app

License

Apache License 2.0

Releases

No releases published

Packages

No packages published