Sample code for 30+ languages & platforms
Unicode C++ Requires Chilkat v11.0.0+

Send an email with a Bcc recipient using SMTP (live send)

See more Email Object Examples

Live send. Load the previously prepared with-attachments.eml, add a Bcc recipient, and pass the Email to MailMan.SendEmail. For a real test, use a relay you control, replace the sample sender and recipients (including the Bcc address) with test mailboxes, and obtain credentials from your application’s secret store.

Chilkat Unicode C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    //  Assumes Chilkat is unlocked. See Global Unlock Sample.

    CkEmailW email;
    success = email.LoadEml(L"with-attachments.eml");
    if (success != true) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    //  Enable this option before adding a blind recipient to the message.
    email.put_UncommonOptions(L"NoBccHeader");
    success = email.AddBcc(L"Bcc recipient",L"bcc@example.net");
    if (success != true) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    CkMailManW mail;
    mail.put_SmtpHost(L"smtp.example.com");
    mail.put_SmtpPort(465);
    mail.put_SmtpSsl(true);
    mail.put_RequireSslCertVerify(true);
    mail.put_SmtpUsername(L"MAIL_USER");
    mail.put_SmtpPassword(L"MAIL_PASSWORD");
    success = mail.SendEmail(email);
    if (success != true) {
        wprintf(L"%s\n",mail.lastErrorText());
        return;
    }

    wprintf(L"The SMTP relay accepted the message.\n");
    success = mail.CloseSmtpConnection();
    if (success != true) {
        wprintf(L"%s\n",mail.lastErrorText());
        return;
    }
    }