Reputation: 43
I'm developing an application ASP.NET, using MailKit v.2.4.1, I'm trying to use ProtocolLogger, but the log file is always empty. This is the code I use:
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 generates an SSPI error, but the log file is always empty.
Upvotes: 2
Views: 1697
Reputation: 38573
The ProtocolLogger doesn't log SSL/TLS negotiation information because that all happens at a lower level inside .NET's SslStream that MailKit does not have access to.
MailKit's ProtocolLogger ONLY logs SMTP, POP3 and/or IMAP commands.
Upvotes: 3