On Wed, May 19, 2010 at 05:24, Brian Candler B.Candler@pobox.com wrote:
Then you're testing the whole environment: you'll need to deliver mail either by making SMTP connections or by invoking your LDA (e.g. sendmail) and piping the mail in - with some way of forcing it to look "spammy" or "not spammy" - to check the blocking. Then you'll use IMAP to retrieve them. This is clearly more than testing just IMAP; rather, you're testing the whole mail server platform and its configs.
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. But I only need a subset which is to just pick up all email from the inbox of a given user@domain, deleting them from the server while depositing them in a designated directory. Each different class of test would be using a different mailbox. Some tests will, when things work as expected, get no mail at all (basically a test for rejecting mail).
I don't know of any ready-made test framework for what you want, and I
suspect it would end up looking much like a programming language by the time you were able to configure all the different tests for processing different flavours of incoming mail.
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.