Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

See the raw IMAP commands when using imaplib or imap_tools

I am writing a Python 3 script to handle IMAP mailboxes, and I am having some problems with the server. When I connect to it "by hand" and try to send raw IMAP commands, the server is unresponsive, and yet when I run the script it does what it does correctly.

Anyway, in order to find out what’s happening with the server I need to see raw IMAP commands that my script is sending, and specially the server’s responses. Is there any way to make either imaplib or imap_tools (the two libraries that I’ve tried) log that information?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use the debug attribute in the IMAP4 class to enable debug output, which includes responses.

As no logging is available in IMAP.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading