title: Trying to send mail via SMTP. No mails arrives and no exception error
body: <p>Problem: Have made a small mail program which works perfectly on my developer pc but when put into production it fails.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      string smtpHost = ConfigurationManager.AppSettings["SmtpAddress"];
      MailMessage mail = new MailMessage();
      mail.From = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]);
      mail.Sender = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]);
      mail.To.Add(new MailAddress("zzz@xxx.yy"));
      mail.Subject = "Test mail";
      mail.Body = string.Format("Is this mail sent via {0} ?", smtpHost);
  
      lblMsg2.Text = string.Format("SmtpHost: {0}", smtpHost); ;
  
      SmtpClient client = new SmtpClient(smtpHost);
      try
      {
          client.Send(mail);
      }
      catch (Exception exception)
      {
          lblMsg3.Text = exception.Message.ToString();
          lblMsg4.Text = exception.InnerException.ToString();
      }
  }
  </code></pre>
  
  <p>I do get the correct mail address and everything on the production server, but nothing ends in my email inbox :-(. I do not receive any exceptions.</p>
  
  <p>I have tried using telnet on the same server and from there I am able to send mails.</p>
  
  <p>I have tried installing WireShark which is looking at the network card on the server and when using telnet I do get the reponse I suspected, but from my program I do not receive anything.</p>
  
  <p>Edited 2012-03-12 @ 09:46 danish time</p>
  
  <p>Have now updated the code to look like this</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e) 
  { 
      string smtpHost = ConfigurationManager.AppSettings["SmtpAddress"]; 
      MailMessage mail = new MailMessage(); 
      mail.From = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]); 
      mail.Sender = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]); 
      mail.To.Add(new MailAddress("zzz@xxx.yy")); 
      mail.Subject = "Test mail"; 
      mail.Body = string.Format("Is this mail sent via {0} ?", smtpHost); 
  
      lblMsg2.Text = string.Format("SmtpHost: {0}", smtpHost); ; 
  
      SmtpClient client = new SmtpClient(smtpHost); 
  
      client.Send(mail); 
  } 
  </code></pre>
  
  <p>And quite interesting: Even when inserting an SMTP-server that does definately not exist, I still do not get any errors on my production environment. I do get an exception on my developer pc which basically means that the smtp-server does not exist (which I also expected to get a message about).</p>