Sample code for 30+ languages & platforms
Delphi DLL

Transition from Email.CreateDsn to Email.ToDsn

Provides instructions for replacing deprecated CreateDsn method calls with ToDsn.

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Email;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
email: HCkEmail;
explanation: PWideChar;
statusFieldsXml: PWideChar;
headerOnly: Boolean;
emailObj: HCkEmail;
dsnEmail: HCkEmail;

begin
success := False;

email := CkEmail_Create();

// ...
// ...

explanation := '...';
statusFieldsXml := '...';
headerOnly := False;

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

emailObj := CkEmail_CreateDsn(email,explanation,statusFieldsXml,headerOnly);
if (CkEmail_getLastMethodSuccess(email) = False) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;

// ...
// ...

CkEmail_Dispose(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.

dsnEmail := CkEmail_Create();
success := CkEmail_ToDsn(email,explanation,statusFieldsXml,headerOnly,dsnEmail);
if (success = False) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;

CkEmail_Dispose(email);
CkEmail_Dispose(dsnEmail);

end;