On Wed, May 19, 2010 at 09:48:02AM -0400, Phil Howard wrote:
Yes, that is what I want to be testing. So I need a way to send mail via SMTP (including TLS and login authentication) as well as picking it up via IMAP. But I chose to only ask for the IMAP piece of it here (and the SMTP piece of it on the Postfix mailing list ... to which Wietse suggested "expect" and "openssl s_client" which I think I can handle using "pexpect" in Python). I know enough SMTP to do that end of things. I don't know the IMAP protocol at all, so something already built would help.
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.
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.
Regards,
Brian.