Apple Mail account names

The Mail application in El Capitan made a few changes. It moved all the email files and folders out of the V2 directory into the V3 directory. It also got rid of the Accounts.plist file that previously contained the display names for all of the Mail email accounts. And it changed the names of the email account folders in /Users/[your home folder]/Library/Mail/v3 from meaningful labels to meaningless hexidecimal character strings.

So I sent this tech support query to Apple:

I am the developer of MailSteward, an email management system that archives email into a relational database. Before El Capitan, I was able to access the email account display names from a file named Accounts.plist. That file no longer exists and I have been unable to find any source for those display names. As a result MailSteward is now using the folder names of the accounts in the V3 directory. However, with new accounts in El Capitan, these folder names are just strings of hexadecimal characters. Is there any way I can find the display names to associate with these hex account ids?

Apple replied:

…Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configureations…

It took awhile, but I finally figured out a way to provide meaningful display names for the Apple Mail email accounts listed in the MailSteward settings. Here is a piece of the objective C code that does the job, after first finding an email file in either the inbox or sent folders, from which I can extract an email address:

if ( [myFilePath containsString:@”Sent”] ) {
if ( [emailBlob containsString:@”Return-path: “] ) {
aRange = [emailBlob rangeOfString:@”Return-path: “];
aRange.location += 13;
} else {
aRange = [emailBlob rangeOfString:@”From: “];
aRange.location += 6;
}
} else {
if ( [emailBlob containsString:@”Envelope-to: “] ) {
aRange = [emailBlob rangeOfString:@”Envelope-to: “];
aRange.location += 13;
} else {
aRange = [emailBlob rangeOfString:@”To: “];
aRange.location += 4;
}
}
if ( aRange.length && [myFilePath hasSuffix:@”.emlx”] ) {
aRange.length = [emailBlob length] – aRange.location;
[myAcctName setString:[emailBlob substringWithRange:aRange]];
aRange.length = [myAcctName rangeOfString:@”\n”].location;
aRange.location = 0;
[myAcctName setString:[myAcctName substringWithRange:aRange]];
[myAcctName replaceOccurrencesOfString:@”\%40″ withString:@”@” options:0 range:NSMakeRange(0, [myAcctName length])];
}
if ( [myFilePath containsString:@”[Gmail]”] ) {
[myAcctName setString:@”Gmail”];
}

Leave a Reply

Your email address will not be published. Required fields are marked *