While setting up the e-mailing features int log4net for an ASP.NET 2.0 project I kept receiving the following exception:
System.Net.Mail.SmtpException: Command not implemented.
The server response was: Command not implemented
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at log4net.Appender.SmtpAppender.SendEmail(String messageBody)
at log4net.Appender.SmtpAppender.SendBuffer(LoggingEvent[] events)
I found this troubling because I had used this feature before and had no problem sending e-mails from other applications. Also another developer was able to use the same exact log4net code on their machine and it worked. It turned out that the host I was using wasn't setup for relaying e-mails through their e-mail server. When I used the .NET 1.1 System.Web.Mail classes with the same e-mail server and configuration I would not receive the exception. It uses a slightly different communication protocol (HELO vs EHLO) that doesn't require relaying to be setup on the e-mail server. So if all else fails and you get the Command Not Implemented exception you could always use the .NET 1.1 System.Web.Mail class.
More Info
http://msexchangeteam.com/archive/2004/02/19/76432.aspx - For setting up an email server for relaying.
http://code.msdn.microsoft.com/KB913616 - For a possible hotfix.