Commit | Line | Data |
8581da38 |
1 | #!/usr/bin/perl |
2 | use strict; |
3 | use warnings; |
4 | use Email::Simple; |
5 | use Email::Simple::Creator; |
6 | |
8581da38 |
7 | use Email::Archive; |
8 | |
9 | my $email = Email::Simple->create( |
10 | header => [ |
c5f5125c |
11 | From => 'foo@example.com', |
8581da38 |
12 | To => 'drain@example.com', |
13 | Subject => 'Message in a bottle', |
14 | 'Message-ID' => 'helloworld', |
15 | ], |
16 | body => 'hello there!' |
17 | ); |
18 | |
c5f5125c |
19 | my $e = Email::Archive->new(); |
58854002 |
20 | $e->connect('dbi:SQLite:dbname=test.db'); |
8581da38 |
21 | print "sending @{[$email->as_string]}\n"; |
22 | $e->store($email); |
23 | |
24 | my $found = $e->retrieve('helloworld'); |
25 | print $found->as_string; |