Click or drag to resize
MimeKit

IProtocolLogger Interface

An interface for logging protocols.

Namespace:  MailKit
Assembly:  MailKit (in MailKit.dll) Version: 2.1.0.0
Syntax
C#
public interface IProtocolLogger : IDisposable

The IProtocolLogger type exposes the following members.

Methods
  NameDescription
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodLogClient
Logs a sequence of bytes sent by the client.
Public methodLogConnect
Logs a connection to the specified URI.
Public methodLogServer
Logs a sequence of bytes sent by the server.
Top
Remarks
An interface for logging protocols.
Examples
C#
public static void SendMessage (MimeMessage message)
{
    using (var client = new SmtpClient (new ProtocolLogger ("smtp.log"))) {
        client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);

        client.Authenticate ("username", "password");

        client.Send (message);

        client.Disconnect (true);
    }
}
See Also