jwSMTP library very basic code sample

#include <jwsmtp/jwsmtp.h>

int main(int argc, char* argv[])
{
   //                 to     from     subject          message      smtp server          port 25            no MX
   jwsmtp::mailer m("root", "root", "subject line", "message body", "localhost", jwsmtp::mailer::SMTP_PORT, false);
   m.send( ); // send the mail
   std::cout << m.response( ) << "\n";
   return 0;
}
If this was a file called myemailer.cpp to compile it into a working program, run the command:
g++ myemailer.cpp -o myemailer `pkg-config --libs --cflags jwsmtp-<version>`
where <version> is the latest version of jwSMTP without the <> symbols.

JohnWiggins.net
email me about