- Home /
Question by
worldofcars · Apr 10, 2012 at 10:44 PM ·
emailsendfrom
Send an email from unity to email adress?
Hello:) I have a question. How to send an email from unity in-game to an email adress? Is this possible, if yes, how?
Comment
Answer by by0log1c · Apr 10, 2012 at 10:56 PM
You will need to use a server-side script (PHP,ASP.NET) to serves as a relay on some webhost. This isn't really related to Unity, but here's the shortest possible example: Note this is more informative than actual implementation.
PHP:
<?php
$address = $_GET["address"];
$subject= $_GET["subject"];
$object= $_GET["object"];
mail($address,$subject,$object);
?>
Unity C#:
string baseURL = "http://www.mywebhost.com/myscript.php?address=%address%&subject=%subject%&object=%object%";
IEnumerator Email(string address, string subject, string object)
{
string url = baseURL;
url = url.Replace("%address%,address);
url = url.Replace("%subject%,subject);
url = url.Replace("%object%,object);
WWW www = new WWW(url);
yield return www;
}
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Add a byte[] as attachment in a mail 1 Answer
send email from unity? 4 Answers
Reading sms from inbox in unity android deployment 1 Answer
Export tree from unity 1 Answer