title: Using MailMessage Class
body: <p>i'm using MailMessage class  to send emails</p>
  
  <pre><code> MailMessage msg = new MailMessage(fromAddr, toAddr);
  </code></pre>
  
  <p>when i create the new MailMessage object it automatically gets the host using the fromAddr.for an example,if my fromaddress is chamara@pindoc.com.au it assumes the host as pindoc.com.au but i have a different name for the host.so the host name is wrong.i think because of that i'm getting the following error.</p>
  
  <p>{"Mailbox unavailable. The server response was: 5.7.1 Unable to relay"} System.Exception {System.Net.Mail.SmtpFailedRecipientException}</p>
  
  <p>how can i solve this?</p>