title: PHP mail() function is not working in namecheap server
body: <p>I am new in namecheap domain server. 
  I am trying to send a simple mail on that namecheap server. It wasn't sending mail and returned an empty value not any error.</p>
  
  <p>Here is my sample code.</p>
  
  <pre><code>$to = "raamanmca@gmail.com";
  $subject = "HTML email";
  $message = "Hello this is testing mail";
  
  // Always set content-type when sending HTML email
  $headers = "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
  
  // More headers
  $headers .= 'From: &lt;ramalingam@binaryswan.com&gt;' . "\r\n";
  $headers .= 'Cc: myboss@example.com' . "\r\n";
  
  if(mail($to,$subject,$message,$headers))
  {
      echo "Mail sent...";    
  }
  else
  {
      echo "Mail not sent";   
  }
  </code></pre>
  
  <p>Suppose i assign $to and $from mailID within a namecheap server mail's then mail sent successfully.</p>
  
  <p>Example:</p>
  
  <pre><code>$to='test@binaryswan.com' 
  $from='hello@binaryswan.com'
  </code></pre>
  
  <p>But i am changing the mail $to OR $from into gmail server like <code>test@gmail.com</code> then it will not send a mail and is also returning empty value without error. How to fix.</p>
  
  <p>From (<a href="https://stackoverflow.com/questions/19070872/not-receiving-email-from-the-php-mail-method">Not receiving email from the PHP mail() method</a>) 
  Only domains that are hosted on our servers can be used in 'From' field. Any domain that is not hosted with us cannot be added to 'From' field. We had to take this measure to prevent sending spam using forums, guest books and contact forms scripts. For your site scripts to work properly you should set 'From' field to email account that has been created in your cPanel.</p>
  
  <p>It's related to my issue but i don't know how to "set 'From' field to email account in my cPanel."</p>