Warning: mail(): Failed to connect to mailserver at ;localhost port 25

I am sending mail to users after their request have been approved or disapproved. Firstly i was using smtp4dev it shows that mail was sent but that didnt showd mail in my mailbox. When i stopped using the software this error started to come. I have done changes in both php.ini and sendmain.ini . Please help me.

          <?php
          session_start();
      if(!isset($_SESSION["Mlogin"]) && !isset($_SESSION["Mlogin"]) == "OK")
   {
        header("location:adminLogin.php");
        exit;
   }
   if(isset($_POST['disapprove']))
  {
        include('connect.php');
        $tbl_name1 = "formC";

      $accountingNo = $_POST['accounting_No'];
      $sql = oci_parse($conn, "SELECT * FROM formS where 
      accountingNo='$accountingNo'");
      $result = oci_execute($sql);
      while($row = oci_fetch_array($sql,OCI_BOTH))
      {
         $p_No = $row[1];
        }

     $sql3 = oci_parse($conn,"select * from userC where p_No = $p_No");
     oci_execute($sql3);
      while($row = oci_fetch_array($sql3,OCI_BOTH))
     {
        $Uemail = $row[3];
     }
       $sql2 = "DELETE FROM formS WHERE accountingNo = $accountingNo";
       $compiled1 = oci_parse($conn,$sql2);
       $ex = oci_execute($compiled1,OCI_DEFAULT);
     echo($sql2);
     oci_commit($conn);

      oci_close($conn);
       $to = $Uemail;
       $subject = "Request Disapproved";
       $txt = "Your payment request has been disapproved. Please contact the 
    person for reasons";
    $headers = "From: [email protected]";

      mail($to,$subject,$txt,$headers);
      header("location:Cpanel.php?msg1=success");    
      }
    else{
header("location:Cpanel.php?msg1=failed");
   }
     ?>

You can try this or check on the given links. May this works for you

1) https://stackoverflow.com/questions/2334250/warning-mail-function-mail-failed-to-connect-to-mailserver-at-localhost

2) https://stackoverflow.com/questions/4591329/failed-to-connect-to-mailserver-at-localhost-port-25-verify-your-smtp-and

3) https://stackoverflow.com/questions/4532486/failed-to-connect-to-mailserver-at-localhost-port-25