Game Development Reference
In-Depth Information
messageField = GUI.TextArea (Rect (100, 120, 200, 200),
messageField);
if(GUI.Button(Rect(50,350,180,50),"Send"))
{
sendEmail();
}
if(showWebMessage)
{
webMessageScreen();
}
}
Step 3. Attach this code to the Main Camera. You can test this
application in the Unity Editor as it does not require your mail
program. It will send data to a server and the server will send
the email. Remember to check your spam folder for the test
email.
Step 4. The server code is written in php. The code is very simple.
In this case, emailer.php is given in Listing 8.6 .
Listing 8.6 php Web Emailer
<?php
$to = $_POST["to"];
$subject = $_POST["subject"];
$body = $_POST["body"];
$headers = 'From: mobileEmailTester@someweb.com' . "\r\n" .
'Reply-To: no-reply@someweb.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $body, $headers))
{
echo("<p>Message successfully sent!</p>");
} else
{
echo("<p>Message delivery failed...</p>");
}
?>
If you have access to a php-enabled Web server, try creating your own php
server file with this code and redirect your mobile app to it. The full URL of
emailer.php should appear in the sendEmail() function of Listing 8.5 .
Search Nedrilad ::




Custom Search