title: C# SmtpServer "The operation has timed out"
body: <p>I have problem in sending mail by smtp and gmail in C# winform application.
  without attachment sending is successfully but when attachment is added application was thrown to System.Net.Mail.SmtpException and it's message is "The operation has timed out."
  what's the problem?!</p>
  
  <pre><code>SmtpClient smtpClient = new SmtpClient();
          Attachment att=new System.Net.Mail.Attachment("Path");
          smtpClient.EnableSsl = true;
          smtpClient.Port = 25;
          smtpClient.Timeout = 20000;
          smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
          smtpClient.UseDefaultCredentials = false;
          smtpClient.Host = "smtp.gmail.com";
          smtpClient.Credentials = new System.Net.NetworkCredential
          (from@gmail.com, "password"  );
  
  
          System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress(from@gmail.com,
              from,
              System.Text.Encoding.UTF8);
  
          System.Net.Mail.MailAddress to = new System.Net.Mail.MailAddress("to@gmail.com");
  
  
  
          MailMessage message = new MailMessage(from, to);
          message.Body = "some text";
          message.BodyEncoding = System.Text.Encoding.UTF8;
          message.Subject = "Subject";
          message.SubjectEncoding = System.Text.Encoding.UTF8;
          message.Bcc.Add(bcc@gmail.com);
  
  
  
          message.Attachments.Add(att);
  
          try
          {
              smtpClient.Send(message);
          }
          catch (System.Net.Mail.SmtpException ex)
          {
              MessageBox.Show(ex.Message); // The operation has timed out
          }
  </code></pre>
  
  <blockquote>
    <p>Edit</p>
  </blockquote>
  
  <p>i have this problem both of gmail and yahoo!</p>