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

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

    email := chilkat.NewEmail()
    email.SetFromName("Workshop team")
    email.SetFromAddress("events@example.com")
    fmt.Println("Formatted From: ", email.From())
    //  Parse a formatted mailbox into its two components.
    email.SetFrom("Alex Rivera <alex@example.net>")
    fmt.Println("Name: ", email.FromName())
    fmt.Println("Address: ", email.FromAddress())

    email.DisposeEmail()