See the raw IMAP commands when using imaplib or imap_tools

45 Views Asked by At

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?

1

There are 1 best solutions below

0
Mathew Styris On BEST ANSWER

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

As no logging is available in IMAP.