Sample code for 30+ languages & platforms
Delphi DLL Requires Chilkat v11.0.0+

Inspect blind-copy recipients and prepare a shareable copy

See more Email Object Examples

Keep the addressed Email object for SMTP submission. When exporting a copy to share, clear its Bcc collection before saving. Treat intermediate MIME buffers as private because a renderer can preserve blind-copy details.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
email: HCkEmail;
i: Integer;
rendered: HCkBinData;
copy: HCkEmail;

begin
success := False;

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

email := CkEmail_Create();
CkEmail_putFrom(email,'Workshop team <events@example.com>');
success := CkEmail_AddTo(email,'Alex Rivera','alex@example.net');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;
CkEmail_putSubject(email,'Workshop registration');
CkEmail_putBody(email,'Your workshop confirmation.');
success := CkEmail_AddBcc(email,'Archive','archive@example.com');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;
i := 0;
while (i < CkEmail_getNumBcc(email)) do
  begin
    Memo1.Lines.Add('Envelope blind copy: ' + CkEmail__getBccAddr(email,i));
    i := i + 1;
  end;

//  Keep the original delivery list intact. Remove blind copies from the export.
rendered := CkBinData_Create();
success := CkEmail_GetMimeBd(email,rendered);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;
copy := CkEmail_Create();
success := CkEmail_SetFromMimeBd(copy,rendered);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(copy));
    Exit;
  end;
CkEmail_ClearBcc(copy);
success := CkEmail_SaveEml(copy,'shareable.eml');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(copy));
    Exit;
  end;
Memo1.Lines.Add('Bcc entries in shareable copy: ' + IntToStr(CkEmail_getNumBcc(copy)));

CkEmail_Dispose(email);
CkBinData_Dispose(rendered);
CkEmail_Dispose(copy);