i have a code that should send mail in php using cpanel , I don't know why it is not working in Cpanel , it is not throwing error too , i gave try catch, but it is not catching any exception. Since am new to Cpanel. I am not able to understand what is the issue
<html>
<head>
<title>Sending HTML email using PHP</title>
</head>
<body>
<?php
try{
$to = "name@doman1.com";
$subject = "This is subject";
$message = "<b>This is HTML message.</b>";
$message .= "<h1>This is headline.</h1>";
$header = "From:name2@gmail.com \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
// if( $retval == true ) {
// echo "Message sent successfully...";
// }else {
// echo "Message could not be sent...";
// }
}catch(Exception $e){
echo "The error is ".$e;
}
?>
</body>
</html>
Can anyone help me with this