imaplib: is this really so unwieldy?
hw
hw at adminart.net
Sun May 30 02:03:14 EDT 2021
On 5/28/21 2:36 AM, boB Stepp wrote:
> On Thu, May 27, 2021 at 6:22 PM Cameron Simpson <cs at cskk.id.au> wrote:
>>
>> On 27May2021 18:42, hw <hw at adminart.net> wrote:
>
>>> So it seems that IMAP support through python is virtually non-existent.
>>
>> This still sureprises me, but I've not tried to use IMAP seriously. I
>> read email locally, and collect it with POP instead. With a tool I wrote
>> myself in Python, as it happens.
>
> I am out of my league here, but what I found in one of my books might
> be helpful. Al Sweigart wrote a useful book, "Automate the Boring
> Stuff in Python". In chapter 16 he considers email. In the "IMAP"
> section he states:
>
> <quote>
> Just as SMTP is the protocol for sending email, the Internet Message
> Access Protocol (IMAP) specifies how to communicate with an email
> provider’s server to retrieve emails sent to your email address.
> Python comes with an imaplib module, but in fact the third-party
> imapclient module is easier to use. This chapter provides an
> introduction to using IMAPClient; the full documentation is at
> http://imapclient.readthedocs.org/.
>
> The imapclient module downloads emails from an IMAP server in a rather
> complicated format. Most likely, you’ll want to convert them from this
> format into simple string values. The pyzmail module does the hard job
> of parsing these email messages for you. You can find the complete
> documentation for PyzMail at http://www.magiksys.net/pyzmail/.
>
> Install imapclient and pyzmail from a Terminal window. Appendix A has
> steps on how to install third-party modules.
> </quote>
>
> In the next little section he shows how to retrieve and delete emails
> with IMAP using the two third-party tools mentioned above. And of
> course there is more. Apparently this book is now in its second
> edition. The first edition is available online for free. The link to
> chapter 16 which discusses email is:
> https://automatetheboringstuff.com/chapter16/ Hopefully this will
> prove helpful to the OP.
Thanks for the pointer!
I don't know which imaplib the author uses; the imaplib I found
definitely doesn't give uids of the messages, contrary to the example
he's giving.
More information about the Python-list
mailing list