My company handover me a existing project develop by somebody else. I have to fix some issues in it but in one of the issue I got stuck. Emails are not sending from the website. I am not sure why this is happening. The code is just simple php email function which sent email. But still it is not working anybody can guess what I am missing?
$to = "test@gmail.com";
$subject = "Property Posted";
$message="TestMessage"
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$form="www.xxxxxxxxxxxxxxxxxxxxx.com";
// More headers
$headers .= 'From: <xyz@example.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";
$checkmail = mail($to,$subject,$message,$headers,$form);
if($checkmail) {
echo "email sent";
} else {
echo failed"
}
Its always hits the else
, though I don't know why.