Is there any way to sent email from iOS device? The best would be automatic hidden after user agrees on such setting in application settings.
Printable View
Is there any way to sent email from iOS device? The best would be automatic hidden after user agrees on such setting in application settings.
You could use Get object and a simple php Script
I'm total noob with PHP so I don't have a clue how to send information from MMF to the PHP file at all :<
I'm a php noob too ;) but it isnt as hard as it sounds. take this example php file:
<?php
$sender = $_REQUEST['from_email'];
$recipient = "your@email.com";
$name = $_REQUEST['from_name'];
$somemoreinfo = $_REQUEST['somemoreinfo'];
$regard = "You've got mail from $name on ".date("d-m-Y");
$mailtext = "$name This shows the name, now we wanna set some break:\n\nWe got some more info from the app: $somemoreinfo.";
mail($recipient, $regard, $mailtext, "From: $sender ");
?>
now all you have to do is upload on your server, and send the needed information via GET OBJECT (Post "sender", "name" and "somemoreinfo")
hope that helps!
Using the GET extension, you just make a condition which will trigger the event get Url and then for this Url value, you put in the URL or the php script that you are using with any added post data to the end...
Condition example
Start of frame
Get URL > "http://www.websitename.com/scriptname.php" + "?recipient=" + Edittext$( "Recipient" ) + "?subject=" + Edittext$( "Subject" ) + "?message=" + Edittext$( "Message" )
If counter=0 + On Get Complete
Set variable to Recieved content.
Set counter to 1.
If variable obtained = "all good"
Get URL > "http://www.websitename.com/scriptname.php" + "?recipient=" + Edittext$( "Recipient" ) + "?subject=" + Edittext$( "Subject" ) + "?message=" + Edittext$( "Message" )
If counter=1 + On Get Complete
Set variable to Recieved content.
Display variable in some form of string if you want the user to see that they are connected.
Set counter to 0.
Which would go to a script like this...
Obviously, you can add more php to validate the email address. Anything "echoed" such as "Message successfully sent!" can be retrieved from the MMF2 application using the "On get complete" condition for the GET object. You just need to make sure the values within the square brackets are exactly the same as the parameters set in the URL of the Get URL event.Code:<?php
if ($_GET["status check"])
{
echo "all good";
exit;
}
$to = $_GET["recipient"];
$subject = $_GET["subject"];
$body = $_GET["message"];
if (mail($to, $subject, $body))
{
echo("Message successfully sent!");
}
else
{
echo("Message delivery failed...");
}
?>
I see StringRay jumped in there and answered first so I just added a little part on which checks that the user has a connection, just in case you want that added in to your game.
this is great, woodyboy! Because i'm a php noob too, i havent known that it's possible to test the connection! thanks for this!
Thanks a lot. I will check it in Some spare time but is it possible to send also receiver email address and not only the sender?
I made a mistake there. You probably found it but just incase, for the first query, the GET URL should only have "status check" as post data. The correction is bolded above.Quote:
Condition example
Start of frame
Get URL > "http://www.websitename.com/scriptname.php" + "?status check=1"
If counter=0 + On Get Complete
Set variable to Recieved content.
Set counter to 1.
If variable obtained = "all good"
Get URL > "http://www.websitename.com/scriptname.php" + "?recipient=" + Edittext$( "Recipient" ) + "?subject=" + Edittext$( "Subject" ) + "?message=" + Edittext$( "Message" )
If counter=1 + On Get Complete
Set variable to Recieved content.
Display variable in some form of string if you want the user to see that they are connected.
Set counter to 0.
I don't quite understand what you mean here. If you are asking if it's possible for the user to receive emails on the device, then I don't think that's possible.Quote:
Thanks a lot. I will check it in Some spare time but is it possible to send also receiver email address and not only the sender?
However, if you have an SQL database, you could set up your own nifty little communications network with PHP and take emails fully out of the equation. I haven't seen that been done much before.
My friend asked me todo or him a small writing tool according to his specifications and one of the functionality would be a standard sent to email (like from Notes so is it possible to run different appliations within MMF?) but we thought it would be great to sent it automatically as a backup. So user provides email in application settings and on that email stuff is sent. Anyway with such code who would appear as a sender and who as receiver?
btw an extension for sending emails with attachement in background is on the way...
There's an existing configurable PHP e-mail send code out there (look for sendeail.php with the missing 'M' typo) which works on POST data, you could tweak that one. :)
StringRay by who and when?
http://community.clickteam.com/showthread.php?t=72839
you have to link the following additional frameworks.
o MessageUI.framework
;)