(Delphi DLL) Load MIME Object from Email Object
Demonstrates how to load a Chilkat Mime object from a Chilkat Email object. (Copies the email into a Mime object.)
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Mime, StringBuilder, Email;
...
procedure TForm1.Button1Click(Sender: TObject);
var
email: HCkEmail;
success: Boolean;
sbMime: HCkStringBuilder;
mime: HCkMime;
begin
email := CkEmail_Create();
success := CkEmail_LoadEml(email,'qa_data/eml/sample.eml');
// Write the full MIME of the email to a StringBuilder.
sbMime := CkStringBuilder_Create();
CkEmail_GetMimeSb(email,sbMime);
// Load the MIME object from the StringBuilder
mime := CkMime_Create();
success := CkMime_LoadMimeSb(mime,sbMime);
Memo1.Lines.Add(CkMime__getMime(mime));
CkEmail_Dispose(email);
CkStringBuilder_Dispose(sbMime);
CkMime_Dispose(mime);
end;
|