Krishnan Venkiteswaran
Krishnan Venkiteswaran

Reputation: 636

Collecting SMTP server using Mailkit with Mimekit

While trying to send an e-mail using MailKit and MimeKit,is there a way to collect the SMTP Output?.

ps: I am trying to migrate my email code from Easymail to Mimekit and Mailkit and I apologize if this is a rather basic query.

Upvotes: 9

Views: 7641

Answers (1)

jstedfast
jstedfast

Reputation: 38538

There's actually a FAQ about this, but for convenience, I'll paste it here:

All of MailKit's client implementations have a constructor that takes a nifty IProtocolLogger interface for logging client/server communications. Out of the box, you can use the handy ProtocolLogger class. Here are some examples of how to use it:

// log to a file called 'smtp.log'
var client = new SmtpClient (new ProtocolLogger ("smtp.log"));

// log to standard output (i.e. the console)
var client = new SmtpClient (new ProtocolLogger (Console.OpenStandardOutput ()));

Upvotes: 16

Related Questions