title: How to resolve "The operation has timed out."?
body: <p>I'm trying to send email using C# code, email was sent when I send it to single person but it is not getting sent when I send it to multiple persons. and getting an error "The operation has timed out." I'm not getting the reason behind it. Please help to find the reason.</p>
  
  <p>Code:</p>
  
  <pre><code> public string SendEmail(List&lt;string&gt; ToEmailAddresses,string body, string emailSubject)
      {  
          var smtp = new SmtpClient { DeliveryMethod = SmtpDeliveryMethod.Network };
  
          smtp.Host = "xyz-host-name";
  
          smtp.Port = 25;
  
          smtp.EnableSsl = false;
  
          var fromAddress = new MailAddress(ConfigurationManager.AppSettings["MailUserName"], "Rewards and Recognition Team");
  
          using (var message = new MailMessage() { Subject = emailSubject, Body = body })
          {
              message.From = fromAddress;
  
              foreach (string email in ToEmailAddresses)
              {
                  message.To.Add(email);
              }
              message.IsBodyHtml = true;
              try
              {
                  _logger.Log("EmailService-SendEmail-try");
                  smtp.Send(message);
                  return "Success";
              }
              catch (Exception ex)
              {
                  _logger.Log("EmailService-SendEmail-" + ex.Message);
                  return "Error";
              }
          }
      }
  </code></pre>