Programmatically change email client / mailto: handler

Hi All,

I’d like to know if there’s a way to change the default mailto: URL handler in OS X. I know how to do this for http in Objective-C, but simply switching out http: with mailto: doesn’t seem to work. Thanks in advance.

p.s. I’m looking for a sandbox-compliant way of doing this

Obj-C code I have for changing http handler:


CFStringRef browserBundleID = (__bridge CFStringRef)@"com.google.chrome";  

LSSetDefaultHandlerForURLScheme(CFSTR("http"), browserBundleID);
NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager];

[em
setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];

This suggests you may be out of luck:

www.sovapps.com/make-your-application-reply-to-mailto-links/

Thanks for this link Shane! Looks like I’ll be submitting a bug report to Apple tonight :confused: