'CPanel : Unable to send Mail using PHP

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 = "[email protected]";
         $subject = "This is subject";
         
         $message = "<b>This is HTML message.</b>";
         $message .= "<h1>This is headline.</h1>";
         
         $header = "From:[email protected] \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



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source