jwz - emlx flags? [entries|archive|friends|userinfo]
jwz

  www.jwz.org
  userinfo
  archive
  rss

Links
[»| DNA (Log) (iCal) WebCollage (LJ) Mixtapes ]

emlx flags? [Mon, 4-Jul-2005 12:43 PM]
Previous Entry Add to Memories Tell a Friend Next Entry
[Tags|, , , ]
[music |Coil -- Hellraiser]

Is there any documentation on what the flags field in Mail.app .emlx files is?

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:

    0read1 << 0
    1deleted1 << 1
    2answered1 << 2
    3encrypted1 << 3
    4flagged1 << 4
    5recent1 << 5
    6draft1 << 6
    7initial (no longer used)1 << 7
    8forwarded1 << 8
    9redirected1 << 9
    10-15  attachment count3F << 10 (6 bits)
    16-22  priority level7F << 16 (7 bits)
    23signed1 << 23
    24is junk1 << 24
    25is not junk1 << 25
    26-28  font size delta7 << 26 (3 bits)
    29junk mail level recorded     1 << 29
    30highlight text in toc1 << 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.

linkReply

Comments:
From: [info]legolas
Mon, 4-Jul-2005 1:08 PM (UTC)

(Link)

Are 'importance' high, low and neither an outlook extension to email or are they standard? If standard, that could be 2 of the bits.
(Replies frozen) (Thread)
[User Picture]From: [info]zetawoof
Mon, 4-Jul-2005 1:48 PM (UTC)

(Link)

Importance flags are in the headers.
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]dr_gluck_
Mon, 4-Jul-2005 1:19 PM (UTC)

(Link)

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.
(Replies frozen) (Thread)
[User Picture]From: [info]jwz
Mon, 4-Jul-2005 1:28 PM (UTC)

(Link)

Yes, I too can guess what these might be used for.
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]zetawoof
Mon, 4-Jul-2005 1:48 PM (UTC)

(Link)

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.
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]zenmonkeykstop
Mon, 4-Jul-2005 1:56 PM (UTC)

(Link)

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.)
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]zetawoof
Mon, 4-Jul-2005 1:58 PM (UTC)

(Link)

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.
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]jwz
Mon, 4-Jul-2005 2:00 PM (UTC)

(Link)

Shut up.
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]zenmonkeykstop
Mon, 4-Jul-2005 1:51 PM (UTC)

(Link)

Hooks for Spotlight, looks like. Read the man pages for mdfind and mdls.
(Replies frozen) (Thread)
[User Picture]From: [info]jwz
Mon, 4-Jul-2005 2:00 PM (UTC)

(Link)

Fascinatingly irrelevant.
(Replies frozen) (Parent) (Thread)
[User Picture]From: [info]zetawoof
Mon, 4-Jul-2005 2:04 PM (UTC)

(Link)

Okay, straightforward answer: No, there is no documentation.
[User Picture]From: [info]strspn
Mon, 4-Jul-2005 8:14 PM (UTC)

(Link)

In order to exaust your administrative remedies, i.e., before faxing a photocopy of your anatomy polite letter to Steve Jobs (408-996-0275), you must ask here.
[User Picture]From: [info]zetawoof
Tue, 5-Jul-2005 12:50 AM (UTC)

Re: message framework header

(Link)

BINGO! Impressive find.
[User Picture]From: [info]jwz
Tue, 5-Jul-2005 2:51 AM (UTC)

Re: message framework header

(Link)

Perfect! Thanks...
[User Picture]From: [info]wfaulk
Tue, 5-Jul-2005 9:19 AM (UTC)

Re: message framework header

(Link)

Has someone decided that only jwz gets to see this answer? Or am I the only one for whom the parent post is missing?
From: [info]fleshmeatstg
Tue, 5-Jul-2005 12:20 PM (UTC)

Re: message framework header

(Link)

It's not just you. I saw it there this morning, but it's gone away since then.
[User Picture]From: [info]zetawoof
Tue, 5-Jul-2005 5:28 PM (UTC)

Re: message framework header

(Link)

Strange. If anyone still has this in their cache (it's fallen out of mine), can they repost it?
[User Picture]From: [info]zetawoof
Wed, 6-Jul-2005 12:24 AM (UTC)

Re: message framework header

(Link)

Our anonymous benefactor says that there's "an issue with some content that caused [him] to want to delete it".
[User Picture]From: [info]reesesx
Tue, 5-Jul-2005 9:06 PM (UTC)

Bits above 31?

(Link)

Out of curiosity, is there a spec for bits > 31? I have a largeish number of messages with bits 34 and 35 set.
[User Picture]From: [info]emexgee
Tue, 5-Jul-2005 9:04 PM (UTC)

slightly bemused...

(Link)

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.

[User Picture]From: [info]jwz
Tue, 5-Jul-2005 9:37 PM (UTC)

Re: slightly bemused...

(Link)

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.
[User Picture]From: [info]zetawoof
Wed, 6-Jul-2005 12:46 AM (UTC)

Re: slightly bemused...

(Link)

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.

#!/bin/sh
osascript <<EOF
on run argv
  set l to {}
  tell application "Mail"
    repeat with acct in every account
      set l to l & (subject of messages of \
          (mailboxes of acct whose name is "Inbox") \
        whose was read is false)
    end repeat
  end tell
  set r to ""
  repeat with i in l
    set r to r & i & "\n"
  end repeat
  return r
end run
EOF
From: [info]kfringe
Wed, 6-Jul-2005 8:13 AM (UTC)

Re: slightly bemused...

(Link)

I am positively giddy with how much of an improvement MacOS is over Linux.

Giddy? Oh dear. That can't be a good sign.
[User Picture]From: [info]zetawoof
Wed, 6-Jul-2005 12:26 AM (UTC)

Re: slightly bemused...

(Link)

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.
[User Picture]From: [info]larryklug
Wed, 6-Jul-2005 6:48 AM (UTC)

Thank you Mask Man!

(Link)

Lenny Bruce rocks!
[User Picture]From: [info]baldnate
Wed, 6-Jul-2005 4:31 PM (UTC)

(Link)

Wait... a message can be junk and not junk? Reminds me of the tea and no tea in the old Hitchiker's Guide game...
[User Picture]From: [info]jwz
Wed, 6-Jul-2005 4:33 PM (UTC)

(Link)

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.
[User Picture]From: [info]kensey
Thu, 7-Jul-2005 10:53 AM (UTC)

(Link)

10-15  	attachment count     3F << 10 (6 bits)
16-22  	priority level       7F << 16 (7 bits)

How many attachments in a single message and priority levels do they anticipate ever existing, anyway?

[User Picture]From: [info]jwz
Thu, 7-Jul-2005 10:59 AM (UTC)

(Link)

I believe the answer to that is obvious!
From: [info]edge_walker
Thu, 7-Jul-2005 11:50 PM (UTC)

(Link)

I would say it’s easy for a complex HTML mail to reach that limit on attachments.
[User Picture]From: [info]kensey
Thu, 14-Jul-2005 1:58 PM (UTC)

(Link)

That's just another reason HTML e-mail is devil-spawned.