title: Send email from ASP.NET application through an external exchange server
body: <p>I have an ASP.NET application pointing the 2.0 version of the framework written in C# deployed in IIS6.</p>
  
  <p>I am maintaining the application therefore some of its parts are not clear to me.</p>
  
  <p>The application has to send email messages through an external exchange server to and from <strong>oldMailAddress</strong> and has been done correctly. Now I added a <strong>newMailAddress</strong> and I haven't changed anything else from the code.</p>
  
  <p>The <strong>oldMailAddress</strong> receives the emails send through the application, the newMailAddress doesn't. I tried to send emails to <strong>newMailAddress</strong> from my mailbox and it works correctly.</p>
  
  <p>I looked for solutions on the Internet and I saw that most of them are based on <strong>SMPT</strong> services installed in IIS6. Well, I do not have these services installed and I think it is not necessary since the application was working with oldMailAddress. Hereby I attach the code that I use, I hope anybody might help.</p>
  
  <pre><code>MailMessage oMail = new MailMessage();
  
  switch (destination)
              {
                  case "production":
                      strMailAddress = "newMailAdress@domain.eu";
                      oMail.From = new MailAddress(strMailAddress);
                      oMail.To.Add(strMailAddress);
                      break;
                  case "warehouse":
                      strMailAddress = "oldMailAdress@domain.eu";
                      oMail.From = new MailAddress(strMailAddress);
                      oMail.To.Add(strMailAddress);
                      break;
              }
  oMail.Subject = sTitle;
  oMail.IsBodyHtml = true;
  oMail.Body = sHTML;
  
  SmtpClient oSmpt = new SmtpClient("external.smpt.eu");
  oSmpt.Send(oMail);
  </code></pre>