为什么我的PHP脚本在从标头设置时不发送电子邮件

I have a php script that is only sending mail when the user registration. I put in something along the lines of:

$to ='testmail@gmail.com';
$message  = 'Hello';
$headers  = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= "From: Website <admin@example.com>
";
if($results= mail($to, 'User Registration', 'Test', $headers)) {
  echo 'success';
} else {
  echo 'fail';
}

But the email doesn't send on server. When i put the following line :

$headers .= "From: Website <admin@example.com>
";

Why is this happening?

Have you looked at the answer to smtp configuration for php mail it's very similar a question to yours?