vladimarius / imapy

Imapy: Imap for Humans
230 stars 22 forks source link

How to view header information #1

Closed graingerkid closed 9 years ago

graingerkid commented 9 years ago

Hey, is there a way to view header information? Particularly looking at how you might track replies via the message id.

vladimarius commented 9 years ago

Hi, I've just pushed example which demonstrates exactly what you've asked for: https://github.com/vladimarius/imapy/blob/master/examples/email_operations.py

Email object contains 'header' field where you can get all required headers. So to get email headers you do something like:

emails = box.folder('Blabla').emails(..query..) headers = emails[0]['headers'] print(headers['Message-Id'][0])

graingerkid commented 9 years ago

Thanks mate :+1:

graingerkid commented 9 years ago

I actually get the following when running this, any idea why? (sorry, obviously trying to figure out the library)

AttributeError: 'NoneType' object has no attribute 'group'
vladimarius commented 9 years ago

Is this error happening in imapy 1.0.2 ? Please run imapy with following additional parameter: box = imapy.connect( host=host, username=username, password=password, ssl=ssl, debug_level=4, # <----- )

And please drop me your log with sensitive information stripped out. Here or to my email at vladimarius # gmail.com

I suppose this is happening in email message parser which encounters errors while parsing some emails.

graingerkid commented 9 years ago

Dropped you an email, mate, let me know if you need anything else.

(I was actually on 1.0.1 but updated and got the same. I have included the debug output and full error.)

vladimarius commented 9 years ago

Fixed in 1.0.3