Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 746
Krishnan Venkiteswaran Avatar asked Jun 24 '16 07:06

Krishnan Venkiteswaran


1 Answers

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 ()));
like image 107
jstedfast Avatar answered Nov 04 '22 00:11

jstedfast