Mail not going thru

hi, i don’t know why the mail in this code is not going thru,(though still in mysql syntax)

  [I]//Get Email Address
    $emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '{$_SESSION['username']}'")or die(mysql_error());
    //$emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '".$_SESSION['username']."'")or die(mysql_error());
    $results = (mysql_fetch_assoc($emails)) or die(mysql_error());
    $email= $results['email'];
    //echo "$email";
	//die();
   if(mysql_num_rows($emails) == 0){
         exit("No email addresses found for user '{$_SESSION['username']}'");
    }
    $email = mysql_result($emails, 0);

    [COLOR="#0000FF"]//Get list to email user
     $body = " Hello $cust_id</br>";
      $body .= "</br>";
$body .= "We are happy to inform you that your order has been received</br>Thanks for making the part payment of &#8358 ". number_format($tranx_amt, 2, '.', '') ." ,<br />Your Payment reference no is $orderno.<br /><br />";

   $body .= "<html><body><table border='1'>
<tr>
<th></th>
<th>Shop Name</th>
<th>Product Name</th>
<th>Size</th>
<th>Color Name</th>
<th>Quantity</th>
<th>weblink</th>
<th>Price</th>
<th>Cost</th>
</tr>";
$totalPrices = 0;
$rowNum = 1;
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'ORDER BY Sname ASC");
while($row = mysql_fetch_assoc($pplresult)){
    $body .= "<tr>
        <td>".$rowNum++."</td>
        <td>" . $row['Sname'] ."</td>
        <td>" . $row['Pname'] ."</td>
        <td>" . $row['Psize'] ."</td>
        <td>" . $row['Pcolour'] ."</td>
        <td>" . $row['Pquantity'] ."</td>
        <td>" . $row['Weblink'] ."</td>
        <td>" . $row['Price'] ."</td>
        <td>" . $row['Tprice'] ."</td>
        </tr>";
         $totalPrices += $row['Tprice'];
}

     if(0.1*$totalPrices <= 50 )
    {
    $totalprice = (0.1*$totalPrices +  $totalPrices);
    }
    else
   {
    $totalprice = 50 + $totalPrices;
        }
$body .= "<tr>
			<td colspan=6>Total :</td>

            <td>" . $totalprice ."</td>
        </tr>";

$body .="</table></body></html><br /><br />";
//$body .="</ br>";
$body .="$fullname</br>$houseno</br> $addressa</br>$addressb</br>$addressc</br>$county</br>$state</br>$country</br></br>";
$body .="Please do not hesitate to contact us for any information via support@reacheasy.co.uk</ br>Thanks!";
   //Send email
$to = $email;
   $subject = "YOUR ORDER LIST($orderno) FROM REACHEASY";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
";
            //. 'Bcc:mgltd@me.com' . "\\r\
";

mail($to,$subject,$body,$headers);

   $body = "<html><body><table border='1'>
<tr>
<th></th>
<th>Shop Name</th>
<th>Product Name</th>
<th>Size</th>
<th>Color Name</th>
<th>Quantity</th>
<th>weblink</th>
<th>info</th>
<th>Price</th>
<th>Cost</th>
</tr>";
$totalPrices = 0;
$rowNum = 1;
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'ORDER BY Sname ASC");
while($row = mysql_fetch_assoc($pplresult)){
    $body .= "<tr>
         <td>".$rowNum++."</td>
        <td>" . $row['Sname'] ."</td>
        <td>" . $row['Pname'] ."</td>
        <td>" . $row['Psize'] ."</td>
        <td>" . $row['Pcolour'] ."</td>
        <td>" . $row['Pquantity'] ."</td>
        <td>" . $row['Weblink'] ."</td>
         <td>" . $row['comment'] ."</td>
        <td>" . $row['Price'] ."</td>
        <td>" . $row['Tprice'] ."</td>
        </tr>";
         $totalPrices += $row['Tprice'];
}
  if(0.1*$totalPrices <= 50 )
    {
    $totalprice = (0.1*$totalPrices +  $totalPrices);
    }
    else
   {
    $totalprice = 50 + $totalPrices;
        }
$body .= "<tr>
			<td colspan=8>Total :</td>
            <td>" . $totalprice ."</td>
        </tr>";
$body .="</table></body></html></br></br>";
$body .="$fullname</br>$houseno</br> $addressa</br>$addressb</br>$addressc</br>$county</br>$state</br>$country</br></br>";


   //Send email
   $Uname = "{$_SESSION['username']}";
   $emails ="mgltd@me.com";
$to = $emails;
   $subject = "$Uname ORDER LIST($orderno) FROM REACHEASY ";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
"
            . 'Bcc:notification@reacheasy.co.uk' . "\\r\
";

mail($to,$subject,$body,$headers);[/COLOR][/I]

this is the full code below

<?php
require_once("include/session.php");
require_once("include/dataconnect.php");
require_once("include/functions.php");
//var_dump($_SESSION);
 $orderno = $_POST['gtpay_tranx_id'];
 $tranx_scode = $_POST['gtpay_tranx_status_code'];
 $tranx_smsg = $_POST['gtpay_tranx_status_msg'];
 $tranx_amt = $_POST['gtpay_tranx_amt'];
 $tranx_curr = $_POST['gtpay_tranx_curr'];
 $cust_id = $_POST['gtpay_cust_id'];
 $gway_name = $_POST['gtpay_gway_name'];
 $echo_data = $_POST['gtpay_echo_data'];
 $date = date('Y-m-d H:i:s');
//echo $orderno;
//echo $tranx_scode;
//echo $cust_id;
//die();
$custaddress = mysql_query("SELECT * FROM reusers WHERE username = '{$_SESSION['username']}'") or die(mysql_error());
$row = mysql_fetch_array($custaddress);
$fullname = $row{fullname};
$houseno = $row{houseno};
$addressa = $row{addressa};
$addressb = $row{addressb};
$addressc = $row{addressc};
$county = $row{county};
$state = $row{state};
$country = $row{country}; ?>
<?php
        $deletetable = mysql_query("DELETE FROM notify WHERE Uname = '{$_SESSION['username']}'");
  			$transid =  mysql_query("SELECT * FROM notify WHERE Uname = '{$_SESSION['username']}'");
  			 if(mysql_num_rows($transid) != 1)
  			 	{
  $queryreg = mysql_query("
                      INSERT INTO notify VALUES ('','$orderno','$tranx_scode','$tranx_smsg','$tranx_amt','$tranx_curr','$cust_id','$gway_name','$echo_data','$date')
                         ")or die(mysql_error());
                  }


$transfer = mysql_query("INSERT INTO storenotify (SELECT  * FROM notify WHERE Uname = '{$_SESSION['username']}')")or die(mysql_error());

  		$errorcode =  mysql_query("SELECT * FROM notify WHERE Uname = '{$_SESSION['username']}'");
       	 $row = mysql_fetch_assoc($errorcode);
  				
  			 if
    	    ($row['amount'] == 0)
       			     {
       			       redirect_to('emessage.php');
       			}
       			  			 if
    	    ($row['transcode'] !== '00')
       			     {
       			       redirect_to('emessage.php');
       			}

$repplaccheck=  mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'");
  			
  			 if(mysql_num_rows($repplaccheck) == 1)
  			 	
  			 	         {
  			 	

    $orderesult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'");
    while($row = mysql_fetch_assoc($orderesult))
    				{
    $pplresult = mysql_query("UPDATE repplac
                 SET orderno = {$orderno} WHERE Uname = '{$_SESSION['username']}'")
                  or die(mysql_error());;
                 	}
    [I]//Get Email Address
    $emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '{$_SESSION['username']}'")or die(mysql_error());
    //$emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '".$_SESSION['username']."'")or die(mysql_error());
    $results = (mysql_fetch_assoc($emails)) or die(mysql_error());
    $email= $results['email'];
    //echo "$email";
	//die();
   if(mysql_num_rows($emails) == 0){
         exit("No email addresses found for user '{$_SESSION['username']}'");
    }
    $email = mysql_result($emails, 0);

    [COLOR="#0000FF"]//Get list to email user
     $body = " Hello $cust_id</br>";
      $body .= "</br>";
$body .= "We are happy to inform you that your order has been received</br>Thanks for making the part payment of &#8358 ". number_format($tranx_amt, 2, '.', '') ." ,<br />Your Payment reference no is $orderno.<br /><br />";

   $body .= "<html><body><table border='1'>
<tr>
<th></th>
<th>Shop Name</th>
<th>Product Name</th>
<th>Size</th>
<th>Color Name</th>
<th>Quantity</th>
<th>weblink</th>
<th>Price</th>
<th>Cost</th>
</tr>";
$totalPrices = 0;
$rowNum = 1;
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'ORDER BY Sname ASC");
while($row = mysql_fetch_assoc($pplresult)){
    $body .= "<tr>
        <td>".$rowNum++."</td>
        <td>" . $row['Sname'] ."</td>
        <td>" . $row['Pname'] ."</td>
        <td>" . $row['Psize'] ."</td>
        <td>" . $row['Pcolour'] ."</td>
        <td>" . $row['Pquantity'] ."</td>
        <td>" . $row['Weblink'] ."</td>
        <td>" . $row['Price'] ."</td>
        <td>" . $row['Tprice'] ."</td>
        </tr>";
         $totalPrices += $row['Tprice'];
}

     if(0.1*$totalPrices <= 50 )
    {
    $totalprice = (0.1*$totalPrices +  $totalPrices);
    }
    else
   {
    $totalprice = 50 + $totalPrices;
        }
$body .= "<tr>
			<td colspan=6>Total :</td>

            <td>" . $totalprice ."</td>
        </tr>";

$body .="</table></body></html><br /><br />";
//$body .="</ br>";
$body .="$fullname</br>$houseno</br> $addressa</br>$addressb</br>$addressc</br>$county</br>$state</br>$country</br></br>";
$body .="Please do not hesitate to contact us for any information via support@reacheasy.co.uk</ br>Thanks!";
   //Send email
$to = $email;
   $subject = "YOUR ORDER LIST($orderno) FROM REACHEASY";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
";
            //. 'Bcc:mgltd@me.com' . "\\r\
";

mail($to,$subject,$body,$headers);

   $body = "<html><body><table border='1'>
<tr>
<th></th>
<th>Shop Name</th>
<th>Product Name</th>
<th>Size</th>
<th>Color Name</th>
<th>Quantity</th>
<th>weblink</th>
<th>info</th>
<th>Price</th>
<th>Cost</th>
</tr>";
$totalPrices = 0;
$rowNum = 1;
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'ORDER BY Sname ASC");
while($row = mysql_fetch_assoc($pplresult)){
    $body .= "<tr>
         <td>".$rowNum++."</td>
        <td>" . $row['Sname'] ."</td>
        <td>" . $row['Pname'] ."</td>
        <td>" . $row['Psize'] ."</td>
        <td>" . $row['Pcolour'] ."</td>
        <td>" . $row['Pquantity'] ."</td>
        <td>" . $row['Weblink'] ."</td>
         <td>" . $row['comment'] ."</td>
        <td>" . $row['Price'] ."</td>
        <td>" . $row['Tprice'] ."</td>
        </tr>";
         $totalPrices += $row['Tprice'];
}
  if(0.1*$totalPrices <= 50 )
    {
    $totalprice = (0.1*$totalPrices +  $totalPrices);
    }
    else
   {
    $totalprice = 50 + $totalPrices;
        }
$body .= "<tr>
			<td colspan=8>Total :</td>
            <td>" . $totalprice ."</td>
        </tr>";
$body .="</table></body></html></br></br>";
$body .="$fullname</br>$houseno</br> $addressa</br>$addressb</br>$addressc</br>$county</br>$state</br>$country</br></br>";


   //Send email
   $Uname = "{$_SESSION['username']}";
   $emails ="mgltd@me.com";
$to = $emails;
   $subject = "$Uname ORDER LIST($orderno) FROM REACHEASY ";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
"
            . 'Bcc:notification@reacheasy.co.uk' . "\\r\
";

mail($to,$subject,$body,$headers);[/COLOR][/I]
     //Transfer records to caselog
         $pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'ORDER BY Sname ASC");
$row = mysql_fetch_assoc($pplresult);
$sname=$row['Sname'];
$pidno=$row['Pidno'];
$pname=$row['Pname'];
$orderno=$row['orderno'];
$uname=$row['Uname'];
$date=$row['date'];

   $queryreg = mysql_query("
INSERT INTO caselog VALUES ('','$uname','$sname','$pname','$orderno','$pidno','$date','','','','{$_SESSION['username']}')
")or die(mysql_error());

        //Transfer records to wishlist
    $transfer = mysql_query("INSERT INTO wishlist (SELECT  * FROM repplac WHERE Uname = '{$_SESSION['username']}')")or die(mysql_error());
    // Delete temporary records if the above query was successful:
    if($transfer !== false){
        $deletetable = mysql_query("DELETE FROM repplac WHERE Uname = '{$_SESSION['username']}'");
    }


     //update credit to zero code awaiting to be released
 $naira = '0';
 $applycredit = mysql_query("SELECT * FROM outstanding WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
 $row = mysql_fetch_assoc($applycredit);


 $queryreg = mysql_query("
UPDATE outstanding
	SET credit = '$naira',
        balafterpaying =   '{$row['outstandingbal']}',
        outstandingbal = '0'
	WHERE Uname = '{$_SESSION['username']}'
 ") or die(mysql_error());


  //send balancing email to clients
 $addprodresult = mysql_query("SELECT * FROM outstanding WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
$row = mysql_fetch_array($addprodresult);
$bal = $row{balafterpaying};
    $emails = mysql_query("SELECT * FROM reusers WHERE username = '{$_SESSION['username']}'")or die(mysql_error());
    //$emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '".$_SESSION['username']."'")or die(mysql_error());
    $results = (mysql_fetch_assoc($emails)) or die(mysql_error());
    $email= $results['email'];

    $to = $email;
   $subject = "$Uname ORDER LIST($orderno) FROM REACHEASY ";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
"
            . 'Bcc:notification@reacheasy.co.uk' . "\\r\
";
     $body = " Good day, Thank you for shopping with us,</br> we will like to inform you that you can make the balancing payment of &pound $bal now,</br></br> NOTE all pending payments are collected with current transactions thanks.";

     mail($to,$subject,$body,$headers);
redirect_to('psxex.php');
}

  			$repplaccheck=  mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'");
  			 if(mysql_num_rows($repplaccheck) != 1)
  			 	{
  			 	
  			 	         $query = mysql_query("UPDATE outstanding
	SET outstandingbal = '0'
			WHERE
			Uname = '{$_SESSION['username']}'
 ") or die(mysql_error());
  			 	
  			 	 //Get Email Address
    $emails = mysql_query("SELECT * FROM reusers WHERE username = '{$_SESSION['username']}'")or die(mysql_error());
    //$emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '".$_SESSION['username']."'")or die(mysql_error());
    $results = (mysql_fetch_assoc($emails)) or die(mysql_error());
    $email= $results['email'];

    $to = $email;
   $subject = "BALANCING PAYMENT FROM REACHEASY ";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
"
            . 'Bcc:notification@reacheasy.co.uk' . "\\r\
";
     $body = " Thanks for the making the balancing payment of ". number_format($tranx_amt, 2, '.', '') .". ";

     mail($to,$subject,$body,$headers);

            			 	 //send bal conf to reacheasy Email Address

    $email= "mgltd@me.com";

    $to = $email;
   $subject = "$Uname ORDER LIST($orderno) FROM REACHEASY ";
 $headers = "From: donotreply@reacheasy.co.uk\\r\
"
            . 'MIME-Version: 1.0' . "\\r\
"
            . 'Content-type: text/html; charset=iso-8859-1' . "\\r\
"
            . 'Bcc:notification@reacheasy.co.uk' . "\\r\
";
     $body = " Thanks for the making the balancing payment of ". number_format($tranx_amt, 2, '.', '') .".</br>$fullname</br>$houseno</br> $addressa</br>$addressb</br>$addressc</br>$county</br>$state</br>$country</br></br> ";

     mail($to,$subject,$body,$headers);


     //update credit to zero code awaiting to be released
 $naira = '0';
 $applycredit = mysql_query("SELECT * FROM outstanding WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
 $row = mysql_fetch_assoc($applycredit);


 $queryreg = mysql_query("
UPDATE outstanding
	SET credit = '$naira',
        balafterpaying =   '{$row['outstandingbal']}',
        outstandingbal = '0'
	WHERE Uname = '{$_SESSION['username']}'
 ") or die(mysql_error());

redirect_to('psxex.php');

}
?>