Skip to content

Commit d350f05

Browse files
committed
Implement maildir mailbox
This a stub for the first mailbox format. To add support for another mailbox implement it in <maildir_format>_mailbox. When the user adds maildir_format = <maildir_format> the file will be required and the new mailbox used automagically.
1 parent 4f3ff1c commit d350f05

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/mailbox/maildir_mailbox.rb

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Maildir_mailbox
2+
require 'mail'
3+
4+
def initialize maildir_path
5+
@maildir_path = maildir_path
6+
@maildir_path = "spec/fixtures/maildir"
7+
end
8+
9+
def mail where={label: nil, folder: nil, from: nil, to: nil, date: nil}
10+
Mail.read(@maildir_path + "/INBOX/cur/TRAIN_00001.eml")
11+
end
12+
13+
def most_recent
14+
mail
15+
end
16+
17+
def labels
18+
["work", "cat pictures", "news"]
19+
end
20+
21+
def folders
22+
%w{ inbox archived spam trash }
23+
end
24+
end

0 commit comments

Comments
 (0)