Simple Email Script

hello, community, after some experiments with GUI.TextAreas and GUI.PasswordFields, i've been inspired to make an email form with unity (to send an automatic email to the person by the game itself.)

so the user will enter 3 inputs: email, username, and password.

I plan on having the game send an email (with my email address) with the player's info to their email address.

i've seen some posts on here about smtp stuff. could someone who knows what they're talking about (even a little bit) please explain to me what smtp is, how to use it, and what it does?

or if you could send me a link to a tutorial on scripting involving smtp or email scripting.

(i'm going to do some youtube researching myself, but any help IS appreciated!!!!)

thank you!

I would recommend you use PHP, and send a request for a separate PHP page that takes the info in the URL, and then sends it. This is the script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Test</title>


$address = $_GET['address'];
$username = $_GET['username'];
$password = $_GET['password'];

$content = "Welcome to my game, and thanks for signing up!
Your login details is as follows:
Username: $username 
Password: $password";

$to = "$address";
$subject = "Thanks for signing up for my game!";
$body = "$content";
$from = "";
$headers = "From: $from";

if (mail($to, $subject, $body, $headers)) {
  echo("<p>Email Sent!</p>");
 } else {
  echo("<p>Email Failed to Send.</p>");


Basically make a new .txt file, open it in WordPad or NotePad, copy that in, edit the message to how you like it (keep in the things with $'s). Edit the email address to select who it's from (note it will always be from your web host, but that is what the users see. It's masked). Then save the file, close your text editing tool, rename the file send_message.php, then upload it to your host (make sure your host is running PHP on their servers).

You want your game to call this url:

Note you may not want to include their password. You can also star it out, if you want. I hope that helps!

This isn't anything you'd do in Unity. You send the data to a web app of some kind (write in in PHP, perl, whatever, but it's off-topic here), which does the actual processing and emailing.