PHP mail()问题是否包含URL

I am trying to send simple html email using PHP mail().

The following code work fine

$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
If(mail('xyz@gmail.com', 'test mail', 'test<hr>this is a test mail', $headers)){
  Echo 'OK';
} else{
  Echo 'Not ok';
}

Problem: as soon as I put some specific url in the body the code still say its ok but email never received

If(mail('xyz@gmail.com', 'test mail', 'test<hr>this is a test mail from www.xyz.com', $headers)){
  Echo 'OK';
} else{
  Echo 'Not ok';
}

Can someone guide me whats the issue and how to fix it?

mail() has a 4th and 5th parameter (optional). The 5th argument is what should be passed as options directly to sendmail . use the following:

$body = 'test<hr>this is a test mail from'.htmlentities('www.xyz.com');

if(mail('xyz@gmail.com','test mail', $body,$headers,'-f from@xyz.com'))
{
....
}

hope it work now :)

and while searching for mail do check your spam folder.