The Cave

24 Nov

Send Email via mailto: on Mac OS X

Simple enough on Mac OS X:
NSString *content = @"subject=Hello&body=Peek-a-boo";
NSString *contentEscaped = [content stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *mailto = [NSString stringWithFormat:@"", contentEscaped];
NSURL *url = [NSURL URLWithString:mailto];
[[UIApplication sharedApplication] openURL:url];
[[NSWorkspace sharedWorkspace] openURL:url];

Hard part was the Mac OS X call (NSWorkspace). There’s plenty of information on the web how to do this – for the iPhone. Needle in the haystack…

Thanks to Bill Dozier for the pointer to Apple’s tech note.

FacebookGoogle GmailGoogle BookmarksTechnorati FavoritesTwitterHotmailYahoo MailYahoo MessengerWordPressStumbleUponRedditEmailInstapaperGoogle+Share

Comments are closed.

© 2015 The Cave | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo