[Tutor] IMAP Help
Remco Gerlich
scarblac@pino.selwerd.nl
Thu, 31 May 2001 22:12:48 +0200
On 0, "Timothy M. Brauch" <tbrauch@mindless.com> wrote:
> Okay, this seemed like something I could have done on my own, but I failed
> miserably. What I want to do is check an IMAP mailbox and see if I have
> any new mail. If I do, I just want to know, if not, then I want it to
> check again in 15 minutes (or 30, or 60 or whatever).
>
> My problem is in using imaplib. I can't figure out what I'm suppose to do.
>
> I've tried
>
> Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> >>> import imaplib
> >>> imaplib.IMAP4('mail.centre.edu')
> <imaplib.IMAP4 instance at 00B596FC>
> >>>
>
> But, where do I go from here? If I can figure out how to do it using
> command line, then I can write a program that will check it. But, I can't
> figure out what to do on the command line. I don't want to read the mail
> or get the subject lines (although, that might be a good idea also), I just
> want to know if I have mail.
You have an IMAP4 object instance, but haven't bound it to a variable so
it's gone again.
Try
>>> x = imaplib.IMAP4("mail.centre.edu")
>>> print x.__doc__
To get some information about the object.
Also, check the library documentation!
IMAP4 objects and their methods are explained in
http://www.python.org/doc/current/lib/imap4-objects.html
And there is a tiny example in
http://www.python.org/doc/current/lib/imap4-example.html
--
Remco Gerlich