从iOS背景发送电子邮件 [英] Send Email in Background from iOS

查看:135
本文介绍了从iOS背景发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

可能发送自动电子邮件?

此问题已被在整个stackoverflow中有多种变体的问题,但是我找不到适用于我的答案,或者我回答了我的问题。它似乎应该更简单,但我只想要的是我的应用程序发送异步电子邮件在后台。没有GUI,没有用户输入,只是当模型中发生了某些事情时,它会发送给我关于它的信息。

This question has been asked in multiple variations throughout stackoverflow, but I can't quite find one that applies to me or that answers my question. It seems like it should be more simple but all I want is for my app to send an asynchronous email in the background. No GUI, no user input, just that when something happens in the model it emails me about it.

提前感谢

乔丹

Thanks in advance,
Jordan

推荐答案

IOS不支持邮件在后台。你必须实施与美国人的互动&只有点击发送按钮才会发送邮件。
作为替代,您应该实现Web&您可以在代码中的任何地方调用。

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:

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

这篇关于从iOS背景发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆