title: Send email using System.Net.Mail through gmail
body: <p>I want to send a email through gmail server. I have put the following code but it is getting stuck while sending. Any idea please....</p>
  <pre><code>MailMessage mail = new MailMessage();
  
  mail.From = new System.Net.Mail.MailAddress(&quot;apps@xxxx.com&quot;);
  
  //create instance of smtpclient
  SmtpClient smtp = new SmtpClient();
  smtp.Port = 465;
  smtp.UseDefaultCredentials = true;
  
  smtp.Host = &quot;smtp.gmail.com&quot;;            
  
  smtp.EnableSsl = true;
  
  //recipient address
  mail.To.Add(new MailAddress(&quot;yyyy@xxxx.com&quot;));
  
  //Formatted mail body
  mail.IsBodyHtml = true;
  string st = &quot;Test&quot;;
  
  mail.Body = st;
  smtp.Send(mail);
  </code></pre>
  <p>The xxxx.com is a mail domain in Google apps.
  Thanks...</p>