PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
oleobject loo_Email
integer n
integer i
// 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.
loo_Email = create oleobject
li_rc = loo_Email.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
destroy loo_Email
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Email.Subject = "GetCcName example"
loo_Email.AddCC("Joe Smith","joe@example.com")
loo_Email.AddCC("Jane Doe","jane@example.com")
n = loo_Email.NumCC
for i = 0 to n - 1
Write-Debug "Cc " + string(i) + " name: " + loo_Email.GetCcName(i)
next
destroy loo_Email