title: Sending mail with task parallel library throws error
body: <p>CODE:-</p>
  
  <pre><code>List&lt;Task&gt; tasks = new List&lt;Task&gt;();
  foreach (var item in arr)//arr contains 1000+ mailids
              {
                  tasks.Add(Task.Factory.StartNew(() =&gt;
                  {
                      using (MailMessage msg = new MailMessage())
                          {
                              msg=getmsg();//p-shadow code no erorr here
                              SmtpClient smtp = new SmtpClient();
                              smtp.Host = smtpServer;
                              smtp.Port = smtpPort;
                              smtp.EnableSsl = isSmtpSsl != 0 ? true : false;
                              smtp.Credentials = new NetworkCredential(smtpUName,smtpPass);
                              smtp.Timeout = int.MaxValue;
                              smtp.Send(msg);//---throws error....
                              //sql code to insert db that mail is send
                          }
                  }, TaskCreationOptions.LongRunning));
              }
              Task.WaitAll(tasks.ToArray&lt;Task&gt;());
  </code></pre>
  
  <p>ERROR-"Failure sending mail."</p>
  
  <p>INTERNAL ERROR-"Unable to read data from the transport connection: net_io_connectionclosed."</p>