On Wed, May 19, 2010 at 10:04, Brian Candler B.Candler@pobox.com wrote:
If you can do SMTP, you can do IMAP. This should get you started:
a login foo@bar.com xyzzy a select inbox -- or "a examine inbox" for read-only a fetch 1:15 (rfc822) a store 1:15 +flags (\Deleted) a expunge a logout
Also useful:
a namespace -- folder separator chars a list "" "*" -- list folder hierarchy
Flick through RFC3501 for anything else you need.
I might have to do that sometime. But from what I've seen of IMAP it is more complex than SMTP. POP3 was (though not greatly so). Still, I don't feel I'd want to implement a POP3 tool (and don't need one).
An IMAP library might be doable (though not in Perl since I don't know that language and don't have the time to learn it), but the basic "just pick up and delete all mail" would be sufficient.
As suggested by someone else, you can use 'fetchmail' to do that. Normally it delivers using SMTP, but with appropriate flags I believe it can pipe all the retrieved mail to stdout. And if these are all separate mailboxes, POP3 will do for your purposes anyway.
Or maybe just hack its source code?