title: Troubleshooting "Mailbox unavailable. The server response was: Access denied - Invalid HELO name" when sending email with SmtpClient
body: <p>I have been trying to send an email by C#. I have Googled for various examples and have taken bits and pieces from each and from the standard code which everyone would most probably be using.</p>
  
  <pre><code>string to = "receiver@domain.com";
  string from = "sender@domain.com";
  string subject = "Hello World!";
  string body =  "Hello Body!";
  MailMessage message = new MailMessage(from, to, subject, body);
  SmtpClient client = new SmtpClient("smtp.domain.com");
  client.Credentials = new NetworkCredential("test@domain.com", "password");
  client.Send(message);
  </code></pre>
  
  <p>However, I keep getting an error stating</p>
  
  <blockquote>
    <p>System.Net.Mail.SmtpException: Mailbox
    unavailable. The server response was:
    Access denied - Invalid HELO name (See
    RFC2821 4.1.1.1)</p>
  </blockquote>
  
  <p>So, what do I do now? Is SmtpClient supposed to be special and only work on specific SMTP servers?</p>