Mail.app in 10.4 stores each message in its own file. The first line has an ASCII integer on it, the length in bytes of the message; then comes the message; then an XML "plist" blob with a few key/value pairs like "sender" and "subject". One of those properties is "flags", holding an integer, presumably bits indicating "unread", "replied", etc. But there are a lot of bits set in there -- some otherwise-uncomplicated messages seem to make use of up to 30 bits. What are they?
Update: Please, people, I asked a very straightfoward question. I'm not interested in your guesses. I can guess too. I'm looking for facts. I can also reverse-engineer at least some of it, if I have to. But I'd rather not, if it's actually documented somewhere. Which is why I asked. If you don't know, put your hand down.
Update: An anonymous benefactor has the goods:
0 | read | 1 << 0 |
1 | deleted | 1 << 1 |
2 | answered | 1 << 2 |
3 | encrypted | 1 << 3 |
4 | flagged | 1 << 4 |
5 | recent | 1 << 5 |
6 | draft | 1 << 6 |
7 | initial (no longer used) | 1 << 7 |
8 | forwarded | 1 << 8 |
9 | redirected | 1 << 9 |
10-15 | attachment count | 3F << 10 (6 bits) |
16-22 | priority level | 7F << 16 (7 bits) |
23 | signed | 1 << 23 |
24 | is junk | 1 << 24 |
25 | is not junk | 1 << 25 |
26-28 | font size delta | 7 << 26 (3 bits) |
29 | junk mail level recorded | 1 << 29 |
30 | highlight text in toc | 1 << 30 |
31 | (unused) |
Thank you Mask Man!
Update, 7 Aug 2005: I've posted my Perl code to parse these files: emlx.pl. Using this code you can, e.g., ssh in to your mac and see what messages Mail.app has downloaded while you were away.
Are 'importance' high, low and neither an outlook extension to email or are they standard? If standard, that could be 2 of the bits.
Importance flags are in the headers.
probably flag for follow-up combined with date/time follow-up is due eats up some of those bits. MS has color-enabled flags too -not sure if Mac cares about that though --maybe something similar.
Yes, I too can guess what these might be used for.
Mail doesn't use follow-up flags.
Mail allows for color-coding of messages, but it uses an NSColor for that, which would be 24 bits alone.
Unless it was storing an index value, and keeping the colours in a list elsewhere. (Be a bit of a pain changing every Important! email from Code Red to Code Pink status, if every message stored its own colour.)
Except that there isn't any way to change the color of all messages from the UI. Colors are just colors. They aren't indexed in any way - they're just... color.
Shut up.
Hooks for Spotlight, looks like. Read the man pages for mdfind and mdls.
Fascinatingly irrelevant.
Okay, straightforward answer: No, there is no documentation.
In order to exaust your administrative remedies, i.e., before faxing a
photocopy of your anatomypolite letter to Steve Jobs (408-996-0275), you must ask here.i've been watching this conversion to mac-dom with some bemusement: surely the point of using a mac is that "it just works" and that you're supposed to spend more time doing things rather than trying to recompile the kernel & hack your applications so that you can do things...? and if that isn't what you actually get from using a mac (and my observation is that you're not getting that) then what's the point?
some people are not happy unless they're hacking with something. admit this and be at peace.
Well, the reason I'm looking at these flags at all is because I gave up on trying to install an IMAP server on my Linux machine, which leaves me with no easy way to read my mail when I'm not sitting in front of my Mac. (This is not a huge problem, but sometimes it would be nice.)
So I thought, if I could just hack up a little script to dump any "unread" messages in my few inbox-ish folders to stdout, that would probably be just about good enough. (Certainly better than running "more" on the /var/spool/mail file on the server, since the spam and mailing lists would be omitted.)
And for the record, I am positively giddy with how much of an improvement MacOS is over Linux. It's the bee's knees, as the kids say.
Hmm. You could probably do some sort of cleverness with Applescript if you can be certain that you'll be logged into the console.
Here's a first stab at it.
Giddy? Oh dear. That can't be a good sign.
Just to be contrary, I'll note that you can compile and use your own Mach kernel if you really want to. It's just not necessary very often.
Lenny Bruce rocks!
Wait... a message can be junk and not junk? Reminds me of the tea and no tea in the old Hitchiker's Guide game...
Well, there are 4 states: explicitly junk, explicitly not junk, implicitly junk, implicitly not junk. So you need two bits for that. It's unclear how exactly those two bits are used in flags, though.
How many attachments in a single message and priority levels do they anticipate ever existing, anyway?
I believe the answer to that is obvious!
I would say it’s easy for a complex HTML mail to reach that limit on attachments.
That's just another reason HTML e-mail is devil-spawned.