On Jul 31, 2012, at 10:07 AM, Rob McBroom <mailingli...@skurfer.com> wrote:

> Hello. I’m trying to read Mail’s preferences to find a suitable SMTP server 
> so users don’t have to re-enter such configuration details. It seems to have 
> stopped working and I can’t find a [documented] reason.
> 
> I’ve tried
> 
>    NSUserDefaults *mailPrefs = [[NSUserDefaults alloc] init];
>    NSArray *smtpList = [[mailPrefs persistentDomainForName:@"com.apple.mail"] 
> objectForKey:@"DeliveryAccounts"];
> 
> and
> 
>    NSArray *mailPrefs = (__bridge NSArray 
> *)CFPreferencesCopyValue((CFStringRef)@"DeliveryAccounts", 
> (CFStringRef)@"com.apple.mail", kCFPreferencesCurrentUser, 
> kCFPreferencesAnyHost);
> 
> but neither return any results on a 10.8 system. My application is not 
> sandboxed. Mail is, but so is TextEdit and I have no problem reading its 
> prefs.
> 
> Any ideas? Thanks.

This is obviously non-ideal, but in the absence of a better solution, you could 
use the /usr/bin/defaults program. I just tried it, and it appears to be able 
to read and write from Mail's defaults domain successfully.

Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to