Back to Kbengine

jwSMTP library very basic code sample

kbe/src/lib/dependencies/jwsmtp/docs/basic_code.html

2.5.12669 B
Original Source

jwSMTP library very basic code sample

#include<jwsmtp/jwsmtp.h>intmain(intargc,char* argv[])
{// to from subject message smtp server port 25 no MXjwsmtp::mailer m("root", "root", "subject line", "message body", "localhost", jwsmtp::mailer::SMTP_PORT, false);
   m.send( );// send the mailstd::cout << m.response( ) << "\n";return0;
}

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