0

i have been using mail() in my php script. But whenever I send a mail, I am getting this error :

session_start() : cannot send session cache limiter-headers already sent(output started at myfilepath/somefile.php:line number)

The mail is not being sent. I am getting false upon var_dump(mail(to,subject,message)). Here is the code that I am using :

  <?php
      $name=$_POST['wname'];
      $no=$_POST['wno'];
      $od=$_POST['wod'];

      $to="some@domain.com";

      $subject="Customer Details";
      $message="Following are the details of the customer - NAME : '".$name."' CONTACT NO : '".$no."' ORGANIZATION & DESIGNATION : '".$od."'" ;
      echo $message;

      /*if( mail($to,$subject,$message,$headers))   
            echo "mail sent";
        else
            echo "mail not sent";*/
       $result = mail($to,$subject,$message);

       if (!$result) {
            $errorMessage = error_get_last()['message'];
            echo "<br>$errorMessage";
       }

Thanks.

0 Answers0