Sample code for 30+ languages & platforms
PowerBuilder

Set the Sender Email Address

See more Email Object Examples

Demonstrates the Chilkat Email.FromAddress property, which is the email address of the sender. Changing this property updates the address portion of the MIME From header while preserving the sender name when possible. This example sets the sender name and address separately, then reads back the combined From header.

Background: A From header has two parts: the display name (e.g. John Smith) and the email address (e.g. john.smith@example.com). Only the address is used to actually route the message; the display name is cosmetic. Chilkat lets you manipulate each part independently through FromAddress and FromName, or the whole thing at once through From.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Email

//  Demonstrates the Email.FromAddress property (the email address of the sender).
//  Setting it updates the address portion of the From header while preserving
//  the sender name when possible.

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 = "John Smith"
loo_Email.FromAddress = "john.smith@example.com"

Write-Debug "FromAddress = " + loo_Email.FromAddress
Write-Debug "From = " + loo_Email.From


destroy loo_Email