title: SmtpClient does not close session after sending message
body: <p>I have a function that sends email using asp.net built in mail framework. I've included it below. </p>
  
  <pre><code>public void SendMessage()
  {
      var message = new MailMessage();
      var client = new SmtpClient();
  
      // Get the Message Envelope Details
      this.LoadMessageDetailsFromFile();
  
      // Process rules (if any): Rules engine not implemented yet!
      this.SetConfiguration(message);
  
      // Formats the message body template using XSLT
      this.FormatMessageBody(message);
  
      // Adds the attachments 
      this.AddAttachments(message);
  
  
      // Send the mail
      client.Timeout = 999999999;
      client.Send(message);
  
      //Clean up attachments
      foreach (var attachment in message.Attachments)
      {
          attachment.Dispose();
      }
  }
  </code></pre>
  
  <p>Now at no point is the total message size greater than 10MB, however exchange is producing an error saying that 20MB is the max size for each session. Does .net somehow batch send messages to SMTP? Why would it be producing this error, even when each time I send an email, I create a new SMtpClient object?</p>
  
  <p>Exact Exchange Error: Session size exceeds fixed maximum session size</p>
  
  <p>It seems the underlining connection is reused, even if you create new instances of SMTPClient. </p>
  
  <p>Anyone know a workaround, the following does not work:</p>
  
  <pre><code>Smtp client = new SmtpClient("hostname");
  client.ServicePoint.MaxIdleTime = 0;
  client.ServicePoint.ConnectionLimit = 1;
  </code></pre>
  
  <p>Thanks in advance </p>