Maildir

http://www.iron-horse.org/~naokih/bincimap/bincimap-imapdir.html
によるとMaildirはもともとDJBが考えた規格らしい。

http://man.qmail.jp/jman5/maildir.html
に書いてあった。

メッセージの読み方

メイルリーダは以下のように動作します。
newディレクトリにある新着メッセージを探します。仮に、new/uniqueがあったとします。メイルリーダは以下のことを自由に行って構いません。

  new/uniqueの内容を表示する。
  new/uniqueを削除する。
  new/uniqueをcur/unique:infoにrenameする。

infoについては http://pobox.com/~djb/proto/maildir.html を見てください。

メイルリーダにはtmpディレクトリを見て、古いファイルを削除することが期待されています。tmpにあるファイルで36時間以上アクセスされていないものは削除しても安全です。
newやcurディレクトリにあるdotで始まるファイルはすべて無視するのがいいでしょう。上のことを別にすると、メイルリーダはファイル名をパースしてはいけません。

info

info starting with "1,": Experimental semantics.

info starting with "2,": Each character after the comma is an independent flag.

Flag "P" (passed): the user has resent/forwarded/bounced this message to someone else.
Flag "R" (replied): the user has replied to this message.
Flag "S" (seen): the user has viewed this message, though perhaps he didn't read all the way through it.
Flag "T" (trashed): the user has moved this message to the trash; the trash will be emptied by a later user action.
Flag "D" (draft): the user considers this message a draft; toggled at user discretion.
Flag "F" (flagged): user-defined flag; toggled at user discretion.
New flags may be defined later. Flags must be stored in ASCII order: e.g., "2,FRS".