Commit | Line | Data |
8581da38 |
1 | #!/usr/bin/perl |
2 | use strict; |
3 | use warnings; |
5e15a8a0 |
4 | use Email::MIME; |
5 | |
6 | use Test::More; |
8581da38 |
7 | |
8581da38 |
8 | use Email::Archive; |
9 | |
5e15a8a0 |
10 | my $email = Email::MIME->create( |
8581da38 |
11 | header => [ |
c5f5125c |
12 | From => 'foo@example.com', |
8581da38 |
13 | To => 'drain@example.com', |
14 | Subject => 'Message in a bottle', |
15 | 'Message-ID' => 'helloworld', |
16 | ], |
17 | body => 'hello there!' |
18 | ); |
19 | |
c5f5125c |
20 | my $e = Email::Archive->new(); |
5e15a8a0 |
21 | $e->connect('dbi:SQLite:dbname=t/test.db'); |
8581da38 |
22 | $e->store($email); |
23 | |
24 | my $found = $e->retrieve('helloworld'); |
5e15a8a0 |
25 | cmp_ok($found->header('subject'), 'eq', "Message in a bottle", |
26 | "can find stored message by ID"); |
27 | |
28 | done_testing; |
29 | unlink 't/test.db'; |