title: Why does System.Net.Mail fail where System.Web.Mail works
body: <p>I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't get them both to work with smtp.att.yahoo.com.</p>
  
  <p>I get the SMTP settings from my own Web.config keys.   These settings work when I send using System.Web.Mail, but fail with System.Net.Mail.</p>
  
  <pre><code>    &lt;add key="SmtpServer" value="smtp.att.yahoo.com"/&gt;
      &lt;add key="SmtpServerAuthenticateUser" value="ctrager@sbcglobal.net"/&gt;
      &lt;add key="SmtpServerPort" value="465"/&gt;
      &lt;add key="SmtpUseSSL" value="1"/&gt;
      &lt;add key="SmtpServerAuthenticatePassword" value="MY PASSWORD"/&gt;
  </code></pre>
  
  <p>Here is the code that grabs my settings, and works with GMail, fails with att.yahoo:</p>
  
  <pre><code>        SmtpClient smtp;
  
          if (!string.IsNullOrEmpty(Util.get_setting("SmtpServer", "")))
          {
             smtp = new SmtpClient(Util.get_setting("SmtpServer", ""));
          }
          else
          {
             smtp = new SmtpClient();
          }
  
  
          if (!string.IsNullOrEmpty(Util.get_setting("SmtpServerAuthenticatePassword", "")))
             smtp.Credentials = new System.Net.NetworkCredential(
                 Util.get_setting("SmtpServerAuthenticateUser", ""), 
                 Util.get_setting("SmtpServerAuthenticatePassword", ""));
  
          if (!string.IsNullOrEmpty(Util.get_setting("SmtpServerPort", "")))
             smtp.Port = int.Parse(Util.get_setting("SmtpServerPort", ""));
  
          if (Util.get_setting("SmtpUseSSL", "0") == "1")
             smtp.EnableSsl = true;
  
          smtp.Send(message);
  </code></pre>
  
  <p>Is this my problem?</p>
  
  <p><a href="http://blogs.msdn.com/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx" rel="noreferrer">http://blogs.msdn.com/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx</a></p>