Email Messages

There are two principal techniques of sending email messages programmatically with Cocoa. The first is to open an email in the user’s selected email application and allow them to edit or augment the message before sending. The second is to send the message directly from a Cocoa application.

Creating a Message in the User’s Email Client

A compose window can be opened in the user’s email client by creating an NSURL that uses the mailto scheme, and then calling the NSWorkspace method –openURL:.

The parameters that can be passed in a mailto URL are listed in Table 23.3.

Table 23.3. mailto URL Parameters
Query Key Definition
CC Carbon-copy address
BCC Blind carbon-copy address
SUBJECT Subject text
BODY Body text

Each of the values ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.