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

C
#include <C_CkEmail.h>

void ChilkatSample(void)
    {
    HCkEmail email;

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

    email = CkEmail_Create();
    CkEmail_putFromName(email,"Workshop team");
    CkEmail_putFromAddress(email,"events@example.com");
    printf("Formatted From: %s\n",CkEmail_ck_from(email));
    //  Parse a formatted mailbox into its two components.
    CkEmail_putFrom(email,"Alex Rivera <alex@example.net>");
    printf("Name: %s\n",CkEmail_fromName(email));
    printf("Address: %s\n",CkEmail_fromAddress(email));


    CkEmail_Dispose(email);

    }