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

Transition from Email.CreateDsn to Email.ToDsn

Provides instructions for replacing deprecated CreateDsn method calls with ToDsn.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkEmailW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkEmailW email;

    //  ...
    //  ...

    const wchar_t *explanation = L"...";
    const wchar_t *statusFieldsXml = L"...";
    bool headerOnly = false;

    //  ------------------------------------------------------------------------
    //  The CreateDsn method is deprecated:

    CkEmailW *emailObj = email.CreateDsn(explanation,statusFieldsXml,headerOnly);
    if (email.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    //  ...
    //  ...

    delete emailObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using ToDsn.
    //  Your application creates a new, empty Email object which is passed 
    //  in the last argument and filled upon success.

    CkEmailW dsnEmail;
    success = email.ToDsn(explanation,statusFieldsXml,headerOnly,dsnEmail);
    if (success == false) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }
    }