title: C# sending email code suddenly stopped working
body: <p>i have the following code that has worked fine for months but suddently stopped working on this line: </p>
  
  <pre><code>    smtpClient.Send(msg);
  </code></pre>
  
  <p>this is an internal application sending emails to internal people in my company</p>
  
  <p>with the following error:</p>
  
  <p><strong>Mailbox unavailable. The server response was: 5.7.1 Unable to relay for  ABC@comp.com</strong></p>
  
  <p>can anyone think of a reason why this code would work fine for ages and suddently just stop work ?</p>
  
  <pre><code>        MailMessage msg = new MailMessage();
          msg.From = new MailAddress(fromEmailAddress_);
          msg.IsBodyHtml = true;
  
          msg.To.Add(new MailAddress(email.Trim()));
  
          msg.Subject = subject_;
          msg.Body = body_;
          msg.IsBodyHtml = true;
          msg.Priority = MailPriority.High;
  
          var smtpClient = new SmtpClient(_mailServer);
          smtpClient.UseDefaultCredentials = false;
          smtpClient.Credentials = new System.Net.NetworkCredential(_user, _pwd);
  
          try
          {
              smtpClient.Send(msg);
          }
          catch (Exception ex)
          {
              Console.Write(ex.Message);
  
          }
  </code></pre>