Sample code for 30+ languages & platforms
Delphi DLL

Get a Cc Recipient's Name Only

See more Email Object Examples

Demonstrates the Chilkat Email.GetCcName method, which returns only the friendly-name part (not the address) of the Nth carbon-copy recipient. The index is zero-based. This example adds two Cc recipients and prints each one's display name.

Background: A recipient combines a display name with an address, such as Jane Doe <jane@example.com>. GetCcName returns just the Jane Doe portion, which is handy for showing a friendly label in a UI. The name is optional free-form text, so it may be empty — when it is, fall back to the address from GetCcAddr.

Chilkat Delphi DLL Downloads

Delphi DLL
var
email: HCkEmail;
n: Integer;
i: Integer;

begin
//  Demonstrates the GetCcName method, which returns only the friendly-name part (not the
//  address) of the Nth carbon-copy recipient.  The index is zero-based.

email := CkEmail_Create();
CkEmail_putSubject(email,'GetCcName example');

CkEmail_AddCC(email,'Joe Smith','joe@example.com');
CkEmail_AddCC(email,'Jane Doe','jane@example.com');

n := CkEmail_getNumCC(email);

for i := 0 to n - 1 do
  begin
    Memo1.Lines.Add('Cc ' + IntToStr(i) + ' name: ' + CkEmail__getCcName(email,i));
  end;

CkEmail_Dispose(email);