title: '5.7.1 Client does not have permission' error while sending email from code
body: <p>So I have this very basic program that is trying to send an e-mail, but I keep getting</p>
  
  <blockquote>
    <p>Mailbox unavailable. The server response was: 5.7.1 Client does not
    have permissions to send as this sender</p>
  </blockquote>
  
  <p>Here is my program</p>
  
  <pre><code>static void Main(string[] args)
  {
      SmtpClient client = new SmtpClient("Server", 25);
      client.UseDefaultCredentials = false;
      client.DeliveryMethod = SmtpDeliveryMethod.Network;
      client.Credentials = new NetworkCredential("UserName", "Password");
      client.Send(new MailMessage("kevin@hopethisworks.com","Recipient"));
  }
  </code></pre>
  
  <p>I know the credentials work, if I run SMTP Test Tool 3.0 with the same data everything works great.</p>
  
  <p><img src="https://i.stack.imgur.com/l0E21.png" alt="enter image description here"></p>
  
  <p>Here is some screen shots on a receive connector set up for my IP on the exchange server</p>
  
  <p><img src="https://i.stack.imgur.com/ggCZp.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/ir819.png" alt="enter image description here"></p>
  
  <p>Anybody have any ideas what would be causing this error in my code, but not within the simple SMTP testing tool?  Am I missing some kind of authentication option somewhere?  I have quadruple checked all the information is correct and identical in both places and it works in the tool but not in the code.</p>