IOS doesn't support to mail in background. You must implement the USer interaction & only clicking over send button will be sending the mail.
As an alternate you should implement the WebService for this & you can call it anywhere in you code.
php required:
<?php
//-- POST are variables from details.js
$names = $_POST['names'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$crust = $_POST['crust'];
$message1 = $_POST['message'];
//-- clean up the javascript array
$toppings = str_replace('"','',substr(substr(stripslashes($_POST['toppings']),1),0,-1));
$toppings = explode(",\n", $toppings);
//-- Where the order will be sent
$to = $address2;
$subject = "your_Order!";
$message = $message1 ;
//-- The headers will let us send HTML code as an email
$headers = "From: contact@your_domain.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//-- if mail gets sent, return true, else return false. This gets handed off the our onload method in details.js
if (mail($to,$subject,$message,$headers))
{
$response = array('mail' => true);
}
else
{
$response = array('mail' => false);
}
echo json_encode($response);
?>