Sample code for 30+ languages & platforms
Unicode C++

Send email using SSL (port 465).

Send email using SMTP SSL on port 465.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkMailManW.h>
#include <CkEmailW.h>

void ChilkatSample(void)
    {
    bool success = false;

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    // The mailman object is used for sending and receiving email.
    CkMailManW mailman;

    // Set the SMTP server.
    mailman.put_SmtpHost(L"smtp.att.yahoo.com");

    // Set SMTP login and password (if necessary)
    mailman.put_SmtpUsername(L"myUsername@sbcglobal.net");
    mailman.put_SmtpPassword(L"myPassword");

    mailman.put_SmtpSsl(true);
    mailman.put_SmtpPort(465);

    // Create a new email object
    CkEmailW email;

    email.put_Subject(L"This is a test");
    email.put_Body(L"This is a test");
    email.put_From(L"Chilkat Support <support@chilkatsoft.com>");
    success = email.AddTo(L"Chilkat Admin",L"admin@chilkatsoft.com");

    success = mailman.SendEmail(email);
    if (success != true) {
        wprintf(L"%s\n",mailman.lastErrorText());
        return;
    }

    success = mailman.CloseSmtpConnection();
    if (success != true) {
        wprintf(L"Connection to SMTP server not closed cleanly.\n");
    }

    wprintf(L"Mail Sent!\n");
    }