System.Net.Mail.SmtpException: Error in processing

Feb 11, 2011 at 12:32 PM

We are using the code for the extended e-mail action (to be able to set the from address).  The code works fine for individual workflows sending one or two messages, but we are running a Power Shell script to process 2000+ workflows in rapid sucession.  After every 20 workflows we get this error:

System.Net.Mail.SmtpException: Error in processing. The server response was: Error in processing Number of messages exceeds maximum per connection at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.N

We have determined that the issue is related to the SMTPClient object not disposing of it's connection object quickly enough (or does the GC even collect this object?).  My question is what is the quickest way to make the GC collect this object - by using GC. Collect() or is there some other method?

Feb 18, 2011 at 12:38 PM

We have replaced the native SMTPClient class with the SPUtlilty.SendMail() class - this solved the issue.