Hello,

I just discovered that it is possible to implement imap-dl using the
Mail::Box suite.  This would mean we would not need to include any code
parsing and emitting the IMAP protocol in mailscripts.  That seems
strongly preferable.  Let me know what you think.

Here is what the fetch code becomes:

    #!/usr/bin/perl

    use 5.028;
    use strict;
    use warnings;

    use Mail::Box::Manager;

    my $mgr = Mail::Box::Manager->new;
    my $imap_folder = $mgr->open('imap://user:passwd@host:port/INBOX');
    my $maildir     = $mgr->open(
        '/home/spwhitton/Maildir',
        access    => 'a',
        create    => 1,
        keep_dups => 1,
        type      => 'maildir'
    );
    $mgr->moveMessage($maildir, $_) for $imap_folder->messages();
    $mgr->closeAllFolders();

We could even keep all dkg's existing code for parsing getmail configs,
etc., and use Mail::Box only to do the actual fetch and insert.

-- 
Sean Whitton

Attachment: signature.asc
Description: PGP signature

Reply via email to