title: How can I send local Email by using exchange with asp.net?
body: <p>I have a project that need to sends notification for employees by local email. I use SmtpClient class to send email but didn't work! here is the code:  </p>
  
  <pre><code>    MailMessage message = new MailMessage();
  
      message.From = new MailAddress("localmail1@company.com");
      message.To.Add(new MailAddress("localmail2@company.com"));
      message.Subject = "Sending mail";
      message.Body = "Check sending email by Exchange from asp.net code &lt;&gt; ";
  
      SmtpClient client = new SmtpClient("ExchangeDNS", 25);
  
      try
      {
          client.Send(message);
      }
      catch (Exception exc)
      {
          Label1.Text = exc.Message.ToString();
      }  
  </code></pre>
  
  <p>When I click buttons it give me an <code>SmtpException</code> with message : <code>Failure sending mail.</code></p>
  
  <p>NB: we use Exchange server.</p>
  
  <p>How can I solve it?</p>