PHP ордер форма не изпраща емейла

Knoppix_

Registered
Код:
<?php
require('includes/ex2.inc.php');

function sendAdminEmail($total, $order) {
    $admin_email = 'petiob@gmail.com';
    $subject = 'Заявка';
	$lice = stripslashes ( strip_tags( $_POST['last_name']));
    $name = stripslashes( strip_tags( $_POST['first_name'] ) );
    
    $email = stripslashes( strip_tags( $_POST['email'] ) );
    // check for valid email address
    $regex = '/^[\w\+\'\.-]+@[\w\'\.-]+\.[a-zA-Z]{2,}$/';
    if ( !preg_match($regex, $_POST['email']) ) {
        // don't send email
        echo '<p>Въведеният емейл е грешен. Моля въведете коректно емейла си и опитайте отново!.</p>';
        return;
    }
    $phone = stripslashes( strip_tags( $_POST['phone'] ) );
	$tovar = stripslashes( strip_tags( $_POST['tovar'] ) );
    $msg_body = "Заявката е:
    $order 
    
    
    
    Име/Организация: $name
	Лице за контакти: $lice
    Email: $email
    Телефон: $phone
	Дата на товарене: $tovar";
    
    
    
    @mail($admin_email, $subject, $msg_body );
}


function handleOrderInfo() {
    global $PRODUCTS;;
    $str = ''; $total = 0; $order = '';
    while ( list($key, $val) = each($_POST) ) {
        // Check for valid quantity entries > 0
        if ( ( strpos($key, '_qty') !== false ) && is_int( (int)$val) && $val > 0  ) { 
            $pt = strrpos($key, '_qty'); // get product abbr
            $name_pt = substr( $key, 0, $pt);
            
            foreach($PRODUCTS as $product) {
                list($prod_abbr, $prod_name, $prod_price) = $product;
                if ($prod_abbr == $name_pt) {
                    $sub_tot = $val * $prod_price;
                    // build string to display order info
                    $str .= "<p>$val кг $prod_name " . '</p>';
                    
                    $order .= "$val $prod_abbr, ";
                }
            }
        }
    }
    //$total = number_format($total, 2);
    $order = rtrim($order, ', ');
    if ( $str === '' ) {
        $str = '<p>You didn\'t order anything.</p>';
    } else {
        $str = "<h2>Вашата заявка е:</h2>$str";
        sendAdminEmail($total, $order);
    }
    
    return $str;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Your Order</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="includes/ex.css" type="text/css" />
</head>
<body>

<?php
echo handleOrderInfo();
?>
    
    
<p> </p>
<p>A <code>sendAdminEmail</code> function is included in the head of this file. You will need to place your email address there (<code>$admin_email</code>) and uncomment the <code>mail</code> function to send the emails.</p>

<p>Back to <a href=".">index</a></p>

</body>
</html>

Здравейте, това ми е кода само че когато натисна бутон изпрати писмото не отива на емейла ми може ли някой да ми помогне и да ми каже защо!?
 

Back
Горе