0

I am trying to send mail via php script and comparatively new to php. I wrote below code:

<?php
   $to = "xyz@somedomain.com";
   $subject = "This is subject";
   $message = "This is simple text message.";
   $header = "From:abc@somedomain.com \r\n";
   $retval = mail ($to,$subject,$message,$header);
   if( $retval == true )  
   {
      echo "Message sent successfully...";
   }
   else
   {
      echo "Message could not be sent...";
   }
?>

But I not able to send email and retval is returning false. I am also not able to debug the actual error. Please suggest how can I find the root cause?

RN Kushwaha
  • 2,081
  • 3
  • 29
  • 40
Mayank Jain
  • 2,504
  • 9
  • 33
  • 52

0 Answers0