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

Set and read the sender name and address

See more Email Object Examples

Set FromName and FromAddress separately when your application stores them in separate fields. Assign a formatted mailbox to From when that is the input you have. These fields describe the visible author.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Email

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

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.FromName = "Workshop team"
loo_Email.FromAddress = "events@example.com"
Write-Debug "Formatted From: " + loo_Email.From
//  Parse a formatted mailbox into its two components.
loo_Email.From = "Alex Rivera <alex@example.net>"
Write-Debug "Name: " + loo_Email.FromName
Write-Debug "Address: " + loo_Email.FromAddress


destroy loo_Email