Python 中的 ImapClient 活动日志记录
Contents
[
Hide
]
启用活动日志记录
活动日志记录包括记录服务器连接、发送和接收的邮件传输细节、邮件处理期间的错误信息以及客户端或服务器执行的其他操作。要跟踪 IMAP 客户端的活动及其与服务器的交互,请使用以下代码示例,它使用了 ImapClient 类,用于将信息记录到指定的日志文件:
import aspose.email as ae
client = ae.clients.imap.ImapClient("imap.domain.com", 993, "user@domain.com", "pwd", ae.clients.SecurityOptions.SSL_IMPLICIT)
# Set the path to the log file using the LogFileName property.
client.log_file_name = "C:\\Aspose.Email.IMAP.log"
# Set the UseDateInLogFileName property if it is necessary.
client.use_date_in_log_file_name = False