Send email in background from iOS

Possible duplicate:
Can I send an automatic letter?

This question was asked in several ways in stackoverflow, but I can’t find one that applies to me or that answers my question. It sounds like it should be simpler, but all I want is an application to send asynchronous email in the background. There is no graphical user interface, there is no user input, just when something happens in the model, it sends me an email about it.

Thanks in advance,
Jordan

+5
source share
1 answer

IOS . , . WebService , .

php :

<?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);
?>
+13

All Articles