ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/mymap/myimport
Revision: 1.1
Committed: Thu Aug 9 02:57:54 2001 UTC (22 years, 9 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/usr/bin/perl
2    
3     # Usage: myimport oldfolder mailboxname
4    
5     BEGIN { require "mymap.pl" };
6    
7     use Mail::Folder;
8     use Mail::Folder::Mbox;
9     use Mail::Field;
10     use Mail::Field::Received;
11     use Mail::Address;
12     use Date::Parse;
13    
14     my $path = shift;
15    
16     my $user = "schmorp";
17     my $mbox = shift;
18    
19     my $uid = find_uid $user or die "$user: no such user\n";
20    
21     eval { sql_exec "insert into box (uid, name) values (?,?)", $uid, $mbox };
22    
23     my $bid = find_bid $uid, $mbox or die "$mbox: no such mailbox\n";
24    
25     my $f = new Mail::Folder "AUTODETECT", $path, NotMUA => 1
26     or die "$path: unable to open mailfolder";
27    
28     my $id = $f->first_message;
29    
30     do {
31     import_mailmsg($bid, $f->get_message($id));
32     } while ($id = $f->next_message($id));
33    
34