[Tutor] Python IMAP library

Cameron Simpson cs at cskk.id.au
Sat Oct 16 08:58:04 EDT 2021


On 16Oct2021 08:58, Alan Gauld <alan.gauld at yahoo.co.uk> wrote:
>On 15/10/2021 20:42, Julius Hamilton wrote:
>> Is there any support community for this Python library? I don’t see 
>> any mention of it at the documentation:
>> https://docs.python.org/3/library/imaplib.html
>
>It is part of the standard library so the support community is a
>combination of the official mailing lists, primarily this list
>and the main python list.
>
>> Could someone please help me understand the following?
>
>Hopefully someone can, but not me. I've never used imaplib.

Me either, but I looked it over during another discussion.

The imaplib in the standard library is mostly a wrapper adapting between 
the IMAP4 protocol and Python. It doesn't do much sophisticated or 
convenient things - instead it follows the IMAP spec and uses it at a 
very low level. For example, there's no "fetch these messages" methods 
directly. Instead, for the latter, it lets you submit a search (which 
can be complex in IMAP) and returns the core protocol elements for the 
user to manage - because different kinds of searches have different 
kinds of results.

Instead I recommend you try one of the IMAP libraries from PyPI, which 
generally are higher level and easier to use.

Have a look here: https://pypi.org/search/?q=imap

and see if any of the modules are useful, maybe try 
https://pypi.org/project/IMAPClient/

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Tutor mailing list