I am using smtplib.sendmail() and would like to log or capture the smtp client-server dialogue information.
From the documentation for smtplib:
SMTP.set_debuglevel(level)
Set the debug output level. A true value for level results in debug messages for connection and for all messages sent to and received from the server
The example at the bottom of the page linked to above uses that:
server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
Examining the library itself shows you should probably use an integer value that is greater than zero and not True
as the description indicates, although True
will work (as if you supplied 1
).