Working with Sheets in Cocoa
Subject:   Extension: Sending email from Address Book
Date:   2001-10-26 12:07:56
From:   rainwadj
Response to: Extension: Sending email from Address Book

This is a great addition. I figured out how to clean up the string. When the Send Mail button is clicked, I have another sheet open with fields for To: (which is filled in with the email addresses from the selected records), Cc:, Bcc: and Subject:, and buttons for Send and Cancel. The action for the Send button on the sheet invokes this method:

- (IBAction)sendEmailMessage:(id)sender
NSMutableString *temp = [NSMutableString
NSString *url;

[temp appendString:[emailToField stringValue]];
[temp appendString:@"?cc="];
[temp appendString:[emailCcField stringValue]];
[temp appendString:@"&bcc="];
[temp appendString:[emailBccField stringValue]];
[temp appendString:@"&subject="];
[temp appendString:[emailSubjField stringValue]];

url = (NSString *)
(NULL, (CFStringRef)temp, NULL, NULL,

[[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:url]];

[NSApp stopModal];

Everything gets put in the proper places in a new message window in Cool stuff.