title: sending email (using gmail SMTP) from windows 7 server
body: <p>There are many threads related to this, and my C# code is below:</p>
  
  <pre><code>public const string REGISTRATION_SMTP_HOST = "smtp.gmail.com ";
  public const int REGISTRATION_SMTP_PORT = 465;
  public const string REGISTRATION_SMTP_LOGIN = "-----@gmail.com";
  public const string REGISTRATION_SMTP_PASSWORD = "----";
  
  // send the email
  SmtpClient smtp = new SmtpClient();
  smtp.Host = CommonCode.REGISTRATION_SMTP_HOST;
  smtp.Port = CommonCode.REGISTRATION_SMTP_PORT;
  smtp.EnableSsl = true;
  smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
  smtp.UseDefaultCredentials = false;
  smtp.Credentials = new NetworkCredential(CommonCode.REGISTRATION_SMTP_LOGIN,CommonCode.REGISTRATION_SMTP_PASSWORD);
  smtp.Timeout = 300000;
  smtp.Send(mm);
  </code></pre>
  
  <p>Running the web application locally from our development Windows 7 boxes, the emails are sent successfully (using port 587).  So our gmail credentials are good.</p>
  
  <p>However, when we deploy the application to our server, the gmail SMTP server is failing to respond.  We have tried ports 465, 587, and 25...same result.</p>
  
  <p>On the server, we have temporarily turned off Windows Firewall.</p>
  
  <p>From the command line on the server, I can telnet into smpt.gmail.com 25 (but not 587 or 465).</p>
  
  <p>The server's IIS SMTP settings are identical to our local workstations.</p>
  
  <p>We have read every post related to this and nothing seems to be working.</p>
  
  <p>Any help would be greatly appreciated.</p>