Sample code for 30+ languages & platforms
DataFlex 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 DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoEmail
    String sTemp1

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

    Get Create (RefClass(cComChilkatEmail)) To hoEmail
    If (Not(IsComObjectCreated(hoEmail))) Begin
        Send CreateComObject of hoEmail
    End
    Set ComFromName Of hoEmail To "Workshop team"
    Set ComFromAddress Of hoEmail To "events@example.com"
    Get ComFrom Of hoEmail To sTemp1
    Showln "Formatted From: " sTemp1
    //  Parse a formatted mailbox into its two components.
    Set ComFrom Of hoEmail To "Alex Rivera <alex@example.net>"
    Get ComFromName Of hoEmail To sTemp1
    Showln "Name: " sTemp1
    Get ComFromAddress Of hoEmail To sTemp1
    Showln "Address: " sTemp1


End_Procedure