我正在使用MailKit v.2.4.1开发应用程序ASP.NET,我正在尝试使用ProtocolLogger,但是日志文件始终为空。这是我使用的代码:
using (SmtpClient smtp = new SmtpClient(new ProtocolLogger(Server.MapPath("~/Log/SMTP.log"))))
using (ImapClient imap = new ImapClient(new ProtocolLogger(Server.MapPath("~/Log/IMAP.log"))))
{
smtp.Connect(bParametri.GetParametro("ServerSMTP").Valore,int.Parse(bParametri.GetParametro("PortaSMTP").Valore), true);
if (smtp.IsConnected)
{
smtp.Authenticate(bParametri.GetParametro("UserSMTP").Valore, bParametri.GetParametro("PasswordSMTP").Valore);
if (smtp.IsAuthenticated)
{
smtp.Send(emailO);
smtp.Disconnect(true);}}}
smtp.Connect会生成SSPI错误,但是日志文件始终为空。
ProtocolLogger不会记录SSL / TLS协商信息,因为所有这些都发生在MailKit无法访问的.NET SslStream的较低级别。
MailKit的ProtocolLogger ONLY记录SMTP,POP3和/或IMAP命令。